Skip to content

Commit 0c4ddb3

Browse files
committed
feat: add Windows builds to publish pipeline
- Include windows-amd64 and windows-arm64 in build matrix - Handle .exe extension for Windows binaries in upload and attestation - Update cache path for Windows runners Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 00c6b4b commit 0c4ddb3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
- runner: ubuntu-latest
6363
os: linux
6464
arch: arm64
65+
- runner: windows-latest
66+
os: windows
67+
arch: amd64
68+
- runner: windows-latest
69+
os: windows
70+
arch: arm64
6571
runs-on: ${{ matrix.runner }}
6672
needs: [create-draft-release]
6773
permissions:
@@ -86,27 +92,33 @@ jobs:
8692
with:
8793
path: |
8894
~/go/pkg/mod
89-
${{ runner.os == 'macOS' && '~/Library/Caches/go-build' || '~/.cache/go-build' }}
95+
${{ runner.os == 'macOS' && '~/Library/Caches/go-build' || runner.os == 'Windows' && '~\\AppData\\Local\\go-build' || '~/.cache/go-build' }}
9096
key: ${{ runner.os }}-go-1.24.x-${{ hashFiles('**/go.sum') }}
9197
restore-keys: |
9298
${{ runner.os }}-go-1.24.x-
9399
- name: Build binary
94100
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
101+
shell: bash
95102
- name: Upload release asset
96103
if: startsWith(github.ref, 'refs/tags/')
97104
run: |
105+
_binary_name=${{ env.APPLICATION_NAME }}
106+
if [ "${{ matrix.os }}" = "windows" ]; then
107+
_binary_name="${{ env.APPLICATION_NAME }}.exe"
108+
fi
98109
_filename=${{ env.APPLICATION_NAME }}-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
99-
tar czf ${_filename} ${{ env.APPLICATION_NAME }}
110+
tar czf ${_filename} ${_binary_name}
100111
curl \
101112
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
102113
-H "Content-Type: application/octet-stream" \
103114
--data-binary @${_filename} \
104115
https://uploads.github.com/repos/${{ github.repository_owner }}/${{ env.APPLICATION_NAME }}/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
116+
shell: bash
105117
- name: Attest binary
106118
if: startsWith(github.ref, 'refs/tags/')
107119
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0 https://github.com/actions/attest-build-provenance/releases/tag/v3.0.0
108120
with:
109-
subject-path: '${{ env.APPLICATION_NAME }}'
121+
subject-path: "${{ matrix.os == 'windows' && format('{0}.exe', env.APPLICATION_NAME) || env.APPLICATION_NAME }}"
110122

111123
build-images:
112124
strategy:

0 commit comments

Comments
 (0)