|
1 |
| -# GitHub release workflow. |
2 |
| -# |
3 |
| -# This workflow is a bit complicated because we have to build darwin binaries on |
4 |
| -# a mac runner, but the mac runners are extremely slow. So instead of running |
5 |
| -# the entire release on a mac (which will take an hour to run), we run only the |
6 |
| -# mac build on a mac, and the rest on a linux runner. The final release is then |
7 |
| -# published using a final linux runner. |
8 | 1 | name: release
|
9 | 2 | on:
|
10 | 3 | push:
|
11 | 4 | tags:
|
12 | 5 | - "v*"
|
13 | 6 | workflow_dispatch:
|
14 |
| - inputs: |
15 |
| - snapshot: |
16 |
| - description: Perform a snapshot/dry-run release (will not create a GitHub release, required if the ref is not a tag) |
17 |
| - type: boolean |
18 |
| - required: true |
19 | 7 |
|
20 | 8 | jobs:
|
21 |
| - linux-windows: |
22 |
| - runs-on: ubuntu-latest |
| 9 | + goreleaser: |
| 10 | + runs-on: macos-latest |
| 11 | + env: |
| 12 | + # Necessary for Docker manifest |
| 13 | + DOCKER_CLI_EXPERIMENTAL: "enabled" |
23 | 14 | steps:
|
| 15 | + # Docker is not included on macos-latest |
| 16 | + - uses: docker-practice/actions-setup-docker@1.0.10 |
| 17 | + |
24 | 18 | - uses: actions/checkout@v3
|
25 | 19 | with:
|
26 | 20 | fetch-depth: 0
|
27 | 21 |
|
28 |
| - - uses: actions/setup-go@v3 |
29 |
| - with: |
30 |
| - go-version: "~1.18" |
31 |
| - |
32 |
| - - name: Echo Go Cache Paths |
33 |
| - id: go-cache-paths |
34 |
| - run: | |
35 |
| - echo "::set-output name=go-build::$(go env GOCACHE)" |
36 |
| - echo "::set-output name=go-mod::$(go env GOMODCACHE)" |
37 |
| -
|
38 |
| - - name: Go Build Cache |
39 |
| - uses: actions/cache@v3 |
40 |
| - with: |
41 |
| - path: ${{ steps.go-cache-paths.outputs.go-build }} |
42 |
| - key: ${{ runner.os }}-release-go-build-${{ hashFiles('**/go.sum') }} |
| 22 | + - name: Set up QEMU |
| 23 | + uses: docker/setup-qemu-action@v2 |
43 | 24 |
|
44 |
| - - name: Go Mod Cache |
45 |
| - uses: actions/cache@v3 |
46 |
| - with: |
47 |
| - path: ${{ steps.go-cache-paths.outputs.go-mod }} |
48 |
| - key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }} |
49 |
| - |
50 |
| - - name: Cache Node |
51 |
| - id: cache-node |
52 |
| - uses: actions/cache@v3 |
53 |
| - with: |
54 |
| - path: | |
55 |
| - **/node_modules |
56 |
| - .eslintcache |
57 |
| - key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }} |
58 |
| - restore-keys: | |
59 |
| - js-${{ runner.os }}- |
60 |
| -
|
61 |
| - - name: Build Site |
62 |
| - run: make site/out/index.html |
63 |
| - |
64 |
| - - name: Build Linux and Windows binaries with GoReleaser |
65 |
| - uses: goreleaser/goreleaser-action@v3 |
66 |
| - with: |
67 |
| - version: latest |
68 |
| - args: release -f ./.github/.goreleaser-release-linux.yaml --rm-dist --timeout 60m --skip-publish --skip-announce ${{ github.event.inputs.snapshot && '--snapshot' }} |
69 |
| - |
70 |
| - - name: Upload binary artifacts |
71 |
| - uses: actions/upload-artifact@v3 |
72 |
| - with: |
73 |
| - name: linux |
74 |
| - path: ./dist/coder* |
75 |
| - |
76 |
| - # The mac binaries get built on mac runners because they need to be signed, |
77 |
| - # and the signing tool only runs on mac. This darwin job only builds the Mac |
78 |
| - # binaries and uploads them as job artifacts used by the publish step. |
79 |
| - darwin: |
80 |
| - runs-on: macos-latest |
81 |
| - steps: |
82 |
| - - uses: actions/checkout@v3 |
| 25 | + - name: Docker Login |
| 26 | + uses: docker/login-action@v2 |
83 | 27 | with:
|
84 |
| - fetch-depth: 0 |
| 28 | + registry: ghcr.io |
| 29 | + username: ${{ github.repository_owner }} |
| 30 | + password: ${{ secrets.GITHUB_TOKEN }} |
85 | 31 |
|
86 | 32 | - uses: actions/setup-go@v3
|
87 | 33 | with:
|
@@ -133,69 +79,12 @@ jobs:
|
133 | 79 | - name: Build Site
|
134 | 80 | run: make site/out/index.html
|
135 | 81 |
|
136 |
| - - name: Build Darwin binaries with GoReleaser |
137 |
| - uses: goreleaser/goreleaser-action@v3 |
138 |
| - with: |
139 |
| - version: latest |
140 |
| - args: release -f ./.github/.goreleaser-release-darwin.yaml --rm-dist --timeout 60m --skip-publish --skip-announce ${{ github.event.inputs.snapshot && '--snapshot' }} |
141 |
| - env: |
142 |
| - AC_USERNAME: ${{ secrets.AC_USERNAME }} |
143 |
| - AC_PASSWORD: ${{ secrets.AC_PASSWORD }} |
144 |
| - |
145 |
| - - name: Upload binary artifacts |
146 |
| - uses: actions/upload-artifact@v3 |
147 |
| - with: |
148 |
| - name: darwin |
149 |
| - path: ./dist/coder* |
150 |
| - |
151 |
| - publish: |
152 |
| - runs-on: ubuntu-latest |
153 |
| - needs: |
154 |
| - - linux-windows |
155 |
| - - darwin |
156 |
| - env: |
157 |
| - # Necessary for Docker manifest |
158 |
| - DOCKER_CLI_EXPERIMENTAL: "enabled" |
159 |
| - steps: |
160 |
| - - uses: actions/checkout@v3 |
161 |
| - with: |
162 |
| - fetch-depth: 0 |
163 |
| - |
164 |
| - - name: Docker Login |
165 |
| - uses: docker/login-action@v2 |
166 |
| - with: |
167 |
| - registry: ghcr.io |
168 |
| - username: ${{ github.repository_owner }} |
169 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
170 |
| - |
171 |
| - - name: mkdir artifacts |
172 |
| - run: mkdir artifacts |
173 |
| - |
174 |
| - - name: Download darwin artifacts |
175 |
| - uses: actions/download-artifact@v3 |
176 |
| - with: |
177 |
| - name: darwin |
178 |
| - path: ./artifacts |
179 |
| - |
180 |
| - - name: Download Linux and Windows artifacts |
181 |
| - uses: actions/download-artifact@v3 |
182 |
| - with: |
183 |
| - name: linux |
184 |
| - path: ./artifacts |
185 |
| - |
186 |
| - - name: ls ./artifacts |
187 |
| - run: ls ./artifacts |
188 |
| - |
189 |
| - # This will build Docker images and Linux packages. |
190 |
| - - name: Publish release |
| 82 | + - name: Run GoReleaser |
191 | 83 | uses: goreleaser/goreleaser-action@v3
|
192 | 84 | with:
|
193 |
| - # we use the "prebuilt" builder here which is a pro-only feature |
194 |
| - distribution: goreleaser-pro |
195 | 85 | version: latest
|
196 |
| - args: release -f ./.github/.goreleaser-release.yaml --rm-dist --timeout 60m ${{ github.event.inputs.snapshot && '--snapshot' }} |
| 86 | + args: release --rm-dist --timeout 60m |
197 | 87 | env:
|
198 |
| - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
199 | 88 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
200 | 89 | AC_USERNAME: ${{ secrets.AC_USERNAME }}
|
201 | 90 | AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
|
0 commit comments