Skip to content

Commit 9ddb587

Browse files
committed
fixup! chore: split release workflow so the majority happens on Linux
1 parent be842a0 commit 9ddb587

File tree

4 files changed

+132
-65
lines changed

4 files changed

+132
-65
lines changed

.github/workflows/release.yaml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,17 @@ jobs:
4949
- name: Build Site
5050
run: make site/out/index.html
5151

52-
- name: Build Linux binaries with GoReleaser
52+
- name: Build Linux and Windows binaries with GoReleaser
5353
uses: goreleaser/goreleaser-action@v3
5454
with:
5555
version: latest
56-
args: build --rm-dist --timeout 60m --id coder-linux
56+
args: release -f ./.goreleaser-linux.yaml --rm-dist --timeout 60m --snapshot
5757

58-
- name: Build Windows binaries with GoReleaser
59-
uses: goreleaser/goreleaser-action@v3
60-
with:
61-
version: latest
62-
args: build --rm-dist --timeout 60m --id coder-windows
63-
64-
- name: Upload Linux binary artifacts
58+
- name: Upload binary artifacts
6559
uses: actions/upload-artifact@v3
6660
with:
6761
name: linux
68-
path: ./dist/coder-linux-*
69-
70-
- name: Upload Windows binary artifacts
71-
uses: actions/upload-artifact@v3
72-
with:
73-
name: windows
74-
path: ./dist/coder-windows-*
62+
path: ./dist/coder*
7563

7664
# The mac binaries get built on mac runners because they need to be signed,
7765
# and the signing tool only runs on mac. This darwin job only builds the Mac
@@ -133,11 +121,11 @@ jobs:
133121
- name: Build Site
134122
run: make site/out/index.html
135123

136-
- name: Build darwin binaries with GoReleaser
124+
- name: Build Darwin binaries with GoReleaser
137125
uses: goreleaser/goreleaser-action@v3
138126
with:
139127
version: latest
140-
args: build --rm-dist --timeout 60m --id coder-darwin
128+
args: release -f ./.goreleaser-darwin.yaml --rm-dist --timeout 60m --snapshot
141129
env:
142130
AC_USERNAME: ${{ secrets.AC_USERNAME }}
143131
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
@@ -146,7 +134,7 @@ jobs:
146134
uses: actions/upload-artifact@v3
147135
with:
148136
name: darwin
149-
path: ./dist/coder-darwin-*
137+
path: ./dist/coder*
150138

151139
publish:
152140
runs-on: ubuntu-latest
@@ -171,23 +159,20 @@ jobs:
171159
- name: mkdir artifacts
172160
run: mkdir artifacts
173161

174-
- name: Download Linux artifacts
162+
- name: Download darwin artifacts
175163
uses: actions/download-artifact@v3
176164
with:
177-
name: linux
165+
name: darwin
178166
path: ./artifacts
179167

180-
- name: Download Windows artifacts
168+
- name: Download Linux and Windows artifacts
181169
uses: actions/download-artifact@v3
182170
with:
183-
name: windows
171+
name: linux
184172
path: ./artifacts
185173

186-
- name: Download darwin artifacts
187-
uses: actions/download-artifact@v3
188-
with:
189-
name: darwin
190-
path: ./artifacts
174+
- name: ls ./artifacts
175+
run: ls ./artifacts
191176

192177
# This will build Docker images and Linux packages.
193178
- name: Publish release
@@ -196,7 +181,7 @@ jobs:
196181
# we use the "prebuilt" builder here which is a pro-only feature
197182
distribution: goreleaser-pro
198183
version: latest
199-
args: release -f ./.goreleaser-release.yaml --rm-dist --timeout 60m
184+
args: release -f ./.goreleaser-release.yaml --rm-dist --timeout 60m --snapshot
200185
env:
201186
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
202187
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser-release-darwin.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
- rm -f site/out/bin/coder*
5+
6+
archives:
7+
- id: coder-darwin
8+
builds: [coder-darwin]
9+
format: zip
10+
11+
builds:
12+
- id: coder-slim
13+
dir: cmd/coder
14+
ldflags: ["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
15+
env: [CGO_ENABLED=0]
16+
goos: [darwin, linux, windows]
17+
goarch: [amd64, arm, arm64]
18+
goarm: ["7"]
19+
# Only build arm 7 for Linux
20+
ignore:
21+
- goos: windows
22+
goarm: "7"
23+
- goos: darwin
24+
goarm: "7"
25+
hooks:
26+
# The "trimprefix" appends ".exe" on Windows.
27+
post: |
28+
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ trimprefix .Name "coder" }}
29+
30+
- id: coder-darwin
31+
dir: cmd/coder
32+
flags: [-tags=embed]
33+
ldflags: ["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
34+
env: [CGO_ENABLED=0]
35+
goos: [darwin]
36+
goarch: [amd64, arm64]
37+
hooks:
38+
# This signs the binary that will be located inside the zip.
39+
# MacOS requires the binary to be signed for notarization.
40+
#
41+
# If it doesn't successfully sign, the zip sign step will error.
42+
post: |
43+
sh -c 'codesign -s {{.Env.AC_APPLICATION_IDENTITY}} -f -v --timestamp --options runtime {{.Path}} || true'
44+
45+
env:
46+
# Apple identity for signing!
47+
- AC_APPLICATION_IDENTITY=BDB050EB749EDD6A80C6F119BF1382ECA119CCCC
48+
49+
signs:
50+
- ids: [coder-darwin]
51+
artifacts: archive
52+
cmd: ./scripts/sign_macos.sh
53+
args: ["${artifact}"]
54+
output: true
55+
56+
snapshot:
57+
name_template: "{{ .Version }}-devel+{{ .ShortCommit }}"

.goreleaser-release-linux.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
- rm -f site/out/bin/coder*
5+
6+
archives:
7+
- id: coder-linux
8+
builds: [coder-linux]
9+
format: tar.gz
10+
11+
- id: coder-windows
12+
builds: [coder-windows]
13+
format: zip
14+
15+
builds:
16+
- id: coder-slim
17+
dir: cmd/coder
18+
ldflags: ["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
19+
env: [CGO_ENABLED=0]
20+
goos: [darwin, linux, windows]
21+
goarch: [amd64, arm, arm64]
22+
goarm: ["7"]
23+
# Only build arm 7 for Linux
24+
ignore:
25+
- goos: windows
26+
goarm: "7"
27+
- goos: darwin
28+
goarm: "7"
29+
hooks:
30+
# The "trimprefix" appends ".exe" on Windows.
31+
post: |
32+
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ trimprefix .Name "coder" }}
33+
34+
- id: coder-linux
35+
dir: cmd/coder
36+
flags: [-tags=embed]
37+
ldflags: ["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
38+
env: [CGO_ENABLED=0]
39+
goos: [linux]
40+
goarch: [amd64, arm, arm64]
41+
goarm: ["7"]
42+
43+
- id: coder-windows
44+
dir: cmd/coder
45+
flags: [-tags=embed]
46+
ldflags: ["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
47+
env: [CGO_ENABLED=0]
48+
goos: [windows]
49+
goarch: [amd64, arm64]
50+
51+
snapshot:
52+
name_template: "{{ .Version }}-devel+{{ .ShortCommit }}"

.goreleaser-release.yaml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ archives:
33
builds: [release-prebuilt-linux]
44
format: tar.gz
55

6-
- id: coder-windows
7-
builds: [release-prebuilt-windows]
8-
format: zip
9-
10-
- id: coder-darwin
11-
builds: [release-prebuilt-darwin]
12-
format: zip
13-
146
builds:
157
- id: release-prebuilt-linux
168
builder: prebuilt
@@ -20,24 +12,7 @@ builds:
2012
prebuilt:
2113
path: artifacts/coder-linux_{{.Os}}_{{.Arch}}/coder
2214

23-
- id: release-prebuilt-windows
24-
builder: prebuilt
25-
goos: [windows]
26-
goarch: [amd64, arm64]
27-
prebuilt:
28-
path: artifacts/coder-windows_{{.Os}}_{{.Arch}}/coder.exe
29-
30-
- id: release-prebuilt-darwin
31-
builder: prebuilt
32-
goos: [darwin]
33-
goarch: [amd64, arm64]
34-
prebuilt:
35-
path: artifacts/coder-darwin_{{.Os}}_{{.Arch}}/coder
36-
37-
env:
38-
# Apple identity for signing!
39-
- AC_APPLICATION_IDENTITY=BDB050EB749EDD6A80C6F119BF1382ECA119CCCC
40-
15+
# This section is also contained in .goreleaser.yaml.
4116
nfpms:
4217
- id: packages
4318
vendor: Coder
@@ -52,7 +27,7 @@ nfpms:
5227
suggests:
5328
- postgresql
5429
builds:
55-
- coder-linux
30+
- release-prebuilt-linux
5631
bindir: /usr/bin
5732
contents:
5833
- src: coder.env
@@ -65,7 +40,7 @@ nfpms:
6540
# development.
6641
dockers:
6742
- image_templates: ["{{ if not .IsSnapshot }}ghcr.io/coder/coder:{{ .Tag }}-amd64{{ end }}"]
68-
id: coder-linux
43+
id: release-prebuilt-linux
6944
dockerfile: Dockerfile
7045
use: buildx
7146
build_flag_templates:
@@ -113,14 +88,12 @@ docker_manifests:
11388
- ghcr.io/coder/coder:{{ .Tag }}-armv7
11489

11590
release:
116-
ids: [release-prebuilt-linux, release-prebuilt-windows, release-prebuilt-darwin, packages]
91+
ids: [release-prebuilt-linux, packages]
11792
footer: |
11893
## Container Image
11994
- `docker pull ghcr.io/coder/coder:{{ .Tag }}`
120-
121-
signs:
122-
- ids: [coder-darwin]
123-
artifacts: archive
124-
cmd: ./scripts/sign_macos.sh
125-
args: ["${artifact}"]
126-
output: true
95+
# All non-Linux files should just be used as is. We have to import the Linux
96+
# builds so that the docker images get built and package creation works.
97+
extra_files:
98+
- glob: ./artifacts/coder_*_darwin*
99+
- glob: ./artifacts/coder_*_windows*

0 commit comments

Comments
 (0)