Skip to content

Commit 448714a

Browse files
committed
Add more binaries and release them all
This also corrects the fact that the current workflow overwrites the arm64 build
1 parent 26e7995 commit 448714a

File tree

1 file changed

+30
-41
lines changed

1 file changed

+30
-41
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,46 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- v*
67

78
jobs:
89

910
build:
1011
name: Build release binaries
1112
runs-on: ubuntu-latest
13+
1214
steps:
1315
- name: Check out code into the Go module directory
14-
uses: actions/checkout@v2
15-
16-
- name: Set up Go 1.x
17-
uses: actions/setup-go@v2
18-
with:
19-
go-version: ^1.13
20-
id: go
21-
22-
- name: Build AMD64
23-
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -installsuffix nocgo -v -o traefik-forward-auth_amd64 ./cmd
24-
25-
- name: Build ARM
26-
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GO111MODULE=on go build -a -installsuffix nocgo -v -o traefik-forward-auth_arm ./cmd
16+
uses: actions/checkout@v4
2717

28-
- name: Get tag name
29-
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
30-
31-
- name: Get artifact details
32-
uses: octokit/[email protected]
33-
id: get_release_details
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
3420
with:
35-
route: get /repos/${{ github.repository }}/releases/tags/${{ env.TAG }}
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
go-version-file: go.mod
3822

39-
- name: Upload AMD64 release asset
40-
uses: actions/upload-release-asset@v1
23+
- name: Build Binaries
4124
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
upload_url: ${{ fromJson(steps.get_release_details.outputs.data).upload_url }}
45-
asset_path: traefik-forward-auth_amd64
46-
asset_name: traefik-forward-auth_amd64
47-
asset_content_type: application/octet-stream
48-
49-
- name: Upload ARM release asset
50-
uses: actions/upload-release-asset@v1
25+
CGO_ENABLED: 0
26+
GO111MODULE: on
27+
run: |
28+
platforms=(linux windows darwin)
29+
architectures=(amd64 arm64 arm)
30+
31+
for platform in "${platforms[@]}"; do
32+
for arch in "${architectures[@]}"; do
33+
[[ ("${platform}" == "windows" || "${platform}" == "darwin") && "${arch}" == "arm" ]] && continue
34+
35+
echo "Building Traefik-Forward-Auth for ${platform}-${arch}"
36+
GOOS="${platform}" GOARCH="${arch}" go build -a -installsuffix nocgo -o traefik-forward-auth ./cmd
37+
tar cJvf "traefik-forward-auth_${platform}_${arch}.tar.xz" traefik-forward-auth
38+
rm traefik-forward-auth
39+
done
40+
done
41+
42+
- name: Upload Assets
5143
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
with:
54-
upload_url: ${{ fromJson(steps.get_release_details.outputs.data).upload_url }}
55-
asset_path: traefik-forward-auth_arm
56-
asset_name: traefik-forward-auth_arm
57-
asset_content_type: application/octet-stream
44+
GH_TOKEN: ${{ github.token }}
45+
run: |
46+
gh release upload ${GITHUB_REF_NAME} *.tar.xz

0 commit comments

Comments
 (0)