Skip to content

Commit ed2d8f0

Browse files
committed
Publish releases to quay.io and homebrew tap
Improved goreleaser config: also publish docker images to quay.io, and update the homebrew tap.
1 parent fd5378b commit ed2d8f0

File tree

2 files changed

+70
-5
lines changed

2 files changed

+70
-5
lines changed

.github/workflows/release.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424

25-
- name: Log into Docker registry
26-
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin
25+
- name: Log into Docker registries
26+
run: |
27+
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin
28+
echo "${{ secrets.QUAY_IO_PASSWORD }}" | docker login -u ${{ secrets.QUAY_IO_USERNAME }} --password-stdin quay.io
2729
2830
- name: Run GoReleaser
2931
uses: goreleaser/[email protected]
@@ -32,3 +34,4 @@ jobs:
3234
args: release --rm-dist --skip-sign
3335
env:
3436
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

.goreleaser.yml

+65-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
# Goreleaser configuration to build and publish releases on new v* github tags
2+
# (via Github Actions, cf. .github/workflows/release.yml):
3+
# - Build (x86, x86_64, arm64) binaries for Linux, Windows and Mac
4+
# - Build deb and rpm packages
5+
# - Build docker images
6+
# - Publish Github releases (as draft, for manual confirmation)
7+
# - Publish docker images (to docker hub and quay.io)
8+
# - Publish homebrew formula (to https://github.com/bpineau/homebrew-tap)
9+
10+
# Test changes to this file localy with:
11+
# env HOMEBREW_TAP_GITHUB_TOKEN=fake goreleaser release --rm-dist --skip-publish --skip-sign --skip-validate
12+
# Verify goreleaser upgrades with (cf. https://goreleaser.com/deprecations/):
13+
# goreleaser check
14+
115
builds:
2-
-
16+
- id: default
317
ldflags: -s -w -X github.com/bpineau/katafygio/cmd.version={{.Version}}
418
env:
519
- CGO_ENABLED=0
@@ -15,32 +29,61 @@ builds:
1529
- "386"
1630
hooks:
1731
post: make man
32+
# need for "brews" publisher, that doesn't work with flat binaries (see "archives" below)
33+
- id: macosx-tarball
34+
ldflags: -s -w -X github.com/bpineau/katafygio/cmd.version={{.Version}}
35+
env:
36+
- CGO_ENABLED=0
37+
- GO111MODULE=on
38+
goos:
39+
- darwin
40+
goarch:
41+
- amd64
42+
# TODO will be supported in go 1.16 (see https://github.com/goreleaser/goreleaser/issues/1903)
43+
#- arm64
44+
hooks:
45+
post: make man
1846

1947
before:
2048
hooks:
2149
- go mod download
2250

2351
release:
24-
# don't autopublish
52+
# publish github releases as draft, so a human can check and validate
2553
draft: true
2654

2755
archives:
2856
- id: katafygio
2957
format: binary
58+
builds: [default] # publish easy to curl flag files rather than tarballs
59+
- id: macosx-tarball
60+
builds: [macosx-tarball] # for brews below (needs a tarball)
3061

3162
changelog:
3263
filters:
3364
exclude:
3465
- Merge
3566

3667
dockers:
68+
# TODO when stable, use "docker_manifest" to publish multi-arch images
3769
- image_templates:
3870
- "bpineau/katafygio:latest"
3971
- "bpineau/katafygio:{{ .Tag }}"
72+
- "bpineau/katafygio:v{{ .Major }}.{{ .Minor }}"
73+
- "quay.io/bpineau/katafygio:latest"
74+
- "quay.io/bpineau/katafygio:{{ .Tag }}"
75+
- "quay.io/bpineau/katafygio:v{{ .Major }}.{{ .Minor }}"
4076
goos: linux
4177
goarch: amd64
78+
builds: [default]
4279
dockerfile: assets/Dockerfile.goreleaser
43-
skip_push: true
80+
skip_push: false
81+
build_flag_templates:
82+
- "--pull"
83+
- "--label=org.opencontainers.image.created={{.Date}}"
84+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
85+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
86+
- "--label=org.opencontainers.image.version={{.Version}}"
4487

4588
nfpms:
4689
-
@@ -70,3 +113,22 @@ nfpms:
70113
replacements:
71114
386: i386
72115
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
116+
117+
brews:
118+
- name: katafygio
119+
ids: [macosx-tarball] # because brews publisher doesn't accept flat binaries
120+
121+
tap:
122+
owner: bpineau
123+
name: homebrew-tap
124+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
125+
126+
folder: Formula
127+
homepage: "https://github.com/bpineau/katafygio"
128+
description: Discover and continuously backup Kubernetes objets as yaml files in git
129+
license: MIT
130+
skip_upload: false
131+
132+
test: |
133+
system "#{bin}/katafygio version"
134+

0 commit comments

Comments
 (0)