|
5 | 5 | tags: |
6 | 6 | - "*" |
7 | 7 | workflow_dispatch: # Allow triggering manually. |
| 8 | +# ${{ secrets.GH_PAT }} |
8 | 9 |
|
9 | 10 | jobs: |
10 | | - goreleaser: |
| 11 | + build: |
| 12 | + name: Build (${{ matrix.os }}) |
| 13 | + runs-on: ${{ matrix.os }} |
11 | 14 | strategy: |
12 | 15 | matrix: |
13 | 16 | os: [ubuntu-latest, macos-latest, windows-latest] |
14 | 17 |
|
15 | | - runs-on: ${{ matrix.os }} |
16 | | - |
17 | 18 | steps: |
18 | 19 | - name: Checkout |
19 | 20 | uses: actions/checkout@v5 |
20 | 21 |
|
21 | | - - name: Set up Go |
| 22 | + - name: Setup Go |
22 | 23 | uses: actions/setup-go@v5 |
23 | 24 | with: |
24 | | - go-version: 1.24 |
| 25 | + go-version: "1.24" |
25 | 26 |
|
26 | | - - name: Install dependencies (Linux) |
27 | | - if: runner.os == 'Linux' |
28 | | - run: sudo apt-get install -y build-essential |
| 27 | + # --- Install CGO deps per OS --- |
| 28 | + - name: Setup Linux build environment |
| 29 | + if: startsWith(matrix.os, 'ubuntu') |
| 30 | + run: sudo apt-get update && sudo apt-get install -y build-essential |
29 | 31 |
|
30 | | - - name: Install dependencies (macOS) |
31 | | - if: runner.os == 'macOS' |
| 32 | + - name: Setup macOS build environment |
| 33 | + if: startsWith(matrix.os, 'macos') |
32 | 34 | run: brew install gcc |
33 | 35 |
|
34 | | - - name: Install dependencies (Windows) |
35 | | - if: runner.os == 'Windows' |
36 | | - run: choco install mingw |
| 36 | + - name: Setup Windows build environment |
| 37 | + if: startsWith(matrix.os, 'windows') |
| 38 | + run: | |
| 39 | + choco install mingw |
| 40 | + echo "Path=C:/tools/mingw64/bin;$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Append |
37 | 41 |
|
38 | | - - name: Run GoReleaser |
| 42 | + - name: Set build ID |
| 43 | + id: buildid |
| 44 | + run: | |
| 45 | + case "${{ runner.os }}" in |
| 46 | + macOS) |
| 47 | + echo "id=darwin-build" >> $GITHUB_OUTPUT |
| 48 | + ;; |
| 49 | + Windows) |
| 50 | + echo "id=windows-build" >> $GITHUB_OUTPUT |
| 51 | + ;; |
| 52 | + Linux) |
| 53 | + echo "id=linux-build" >> $GITHUB_OUTPUT |
| 54 | + ;; |
| 55 | + *) |
| 56 | + echo "id=unknown-runner-os-${{ runner.os }}" >> $GITHUB_OUTPUT |
| 57 | + ;; |
| 58 | + esac |
| 59 | + shell: bash |
| 60 | + |
| 61 | + - name: Build with GoReleaser |
39 | 62 | uses: goreleaser/goreleaser-action@v6 |
40 | 63 | with: |
| 64 | + distribution: goreleaser |
41 | 65 | version: latest |
42 | | - args: release --clean |
| 66 | + args: release --clean --id ${{ steps.buildid.outputs.id }} --skip-publish |
43 | 67 | env: |
44 | | - GORELEASER_CURRENT_TAG: ${{ github.ref_name }} |
45 | | - GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Upload artifacts |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: artifacts-${{ matrix.os }} |
| 74 | + path: | |
| 75 | + dist/* |
| 76 | + if-no-files-found: error |
0 commit comments