update release workflow (x3) #32
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: Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build_artifacts: | |
name: Build Artifacts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: | |
- linux | |
- windows | |
- darwin | |
goarch: | |
- amd64 | |
- arm64 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "^1.23" | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Infuse Version | |
run: bash scripts/version.sh | |
- name: Build Client (${{ matrix.goos }}-${{ matrix.goarch }}) | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: go build -v -o ./bin/goat-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/goat/main.go | |
- name: Rename Windows Binary | |
if: ${{ matrix.goos == 'windows' }} | |
env: | |
FNAME: ./bin/goat-${{ matrix.goos }}-${{ matrix.goarch }} | |
run: mv ${{ env.FNAME }} ${{ env.FNAME }}.exe | |
- name: Upload Artifcats | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./bin/ | |
retention-days: 1 | |
deploy: | |
name: Deploy to Releases | |
runs-on: ubuntu-latest | |
needs: | |
- 'build_artifacts' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Retrieve backend binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: bin/ | |
merge-multiple: "true" | |
- name: Inject Version into Changelog | |
run: |- | |
sed -i "s/\[VERSION\]/$(git describe --tags --abbrev=0)/g" CHANGELOG.md | |
- name: Set up Hub | |
run: |- | |
sudo snap install hub --classic | |
- name: Deploy to Releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: "hub release create | |
$(ls ./bin -1 | xargs -I % printf '-a ./bin/% ') | |
-F ./CHANGELOG.md | |
$(git describe --tags --abbrev=0)" |