@@ -14,44 +14,41 @@ jobs:
1414 strategy :
1515 matrix :
1616 include :
17- - goos : linux
18- goarch : amd64
19- - goos : linux
20- goarch : arm64
17+ - platform : linux/amd64
18+ arch : amd64
19+ - platform : linux/arm64
20+ arch : arm64
2121 steps :
2222 - uses : actions/checkout@v4
2323
24- - uses : actions/setup-go@v5
25- with :
26- go-version : " 1.25"
27-
28- - uses : oven-sh/setup-bun@v2
24+ - uses : docker/setup-qemu-action@v3
2925
30- - name : Build frontend
31- run : |
32- cd frontend && bun install --frozen-lockfile && bun run build
33- cd ..
34- cp -r frontend/dist internal/frontend/dist
26+ - uses : docker/setup-buildx-action@v3
3527
36- - name : Build binary
37- env :
38- CGO_ENABLED : " 0"
39- GOOS : ${{ matrix.goos }}
40- GOARCH : ${{ matrix.goarch }}
28+ - name : Build binary via Dockerfile
4129 run : |
42- go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" \
43- -o packyard-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/server
30+ docker buildx build \
31+ --platform ${{ matrix.platform }} \
32+ --target export \
33+ --build-arg VERSION=${{ github.ref_name }} \
34+ --output type=local,dest=./out \
35+ --cache-from type=gha \
36+ --cache-to type=gha,mode=max \
37+ .
38+ mv ./out/packyard packyard-linux-${{ matrix.arch }}
4439
4540 - uses : actions/upload-artifact@v4
4641 with :
47- name : packyard-${{ matrix.goos }} -${{ matrix.goarch }}
48- path : packyard-${{ matrix.goos }} -${{ matrix.goarch }}
42+ name : packyard-linux -${{ matrix.arch }}
43+ path : packyard-linux -${{ matrix.arch }}
4944
5045 docker :
5146 runs-on : ubuntu-latest
5247 steps :
5348 - uses : actions/checkout@v4
5449
50+ - uses : docker/setup-qemu-action@v3
51+
5552 - uses : docker/setup-buildx-action@v3
5653
5754 - uses : docker/login-action@v3
7471 context : .
7572 push : true
7673 platforms : linux/amd64,linux/arm64
74+ build-args : |
75+ VERSION=${{ github.ref_name }}
7776 tags : ${{ steps.meta.outputs.tags }}
7877 labels : ${{ steps.meta.outputs.labels }}
7978 cache-from : type=gha
0 commit comments