Build Go binaries and upload release #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Go binaries and upload to weave-binaries release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
name: Build Go binaries | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, darwin] | |
goarch: [amd64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22.6" | |
- name: Build binary | |
run: | | |
mkdir -p build/${{ matrix.goos }}-${{ matrix.goarch }} | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/${{ matrix.goos }}-${{ matrix.goarch }}/weave | |
- name: List files in build directory (optional for debugging) | |
run: ls -R build/ | |
- name: Upload binaries as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: | | |
build/darwin-amd64/weave | |
build/darwin-arm64/weave | |
build/linux-amd64/weave | |
build/linux-arm64/weave | |
upload-to-weave-binaries: | |
name: Upload to weave-binaries release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries | |
- name: Create a release in weave-binaries | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
repository: initia-labs/weave-binaries | |
draft: false | |
prerelease: true | |
token: ${{ secrets.WEAVE_BINARIES_GITHUB_TOKEN }} | |
files: | | |
build/darwin-amd64/weave | |
build/darwin-arm64/weave | |
build/linux-amd64/weave | |
build/linux-arm64/weave |