Update build.yml #29
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 and Release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 'stable' | |
check-latest: true | |
- name: Build binary | |
run: | | |
mkdir -p artifact | |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o aurora -a -ldflags '-s -w -extldflags "-static"' . && rm -f artifact/aurora && cp aurora artifact/aurora && cd artifact && tar -czvf ../aurora-linux-amd64.tar.gz * && cd .. | |
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o aurora -a -ldflags '-s -w -extldflags "-static"' . && rm -f artifact/aurora && cp aurora artifact/aurora && cd artifact && tar -czvf ../aurora-windows-amd64.tar.gz * && cd .. | |
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o aurora -a -ldflags '-s -w -extldflags "-static"' . && rm -f artifact/aurora && cp aurora artifact/aurora && cd artifact && tar -czvf ../aurora-darwin-amd64.tar.gz * && cd .. | |
GOOS=freebsd GOARCH=amd64 CGO_ENABLED=0 go build -o aurora -a -ldflags '-s -w -extldflags "-static"' . && rm -f artifact/aurora && cp aurora artifact/aurora && cd artifact && tar -czvf ../aurora-freebsd-amd64.tar.gz * && cd .. | |
- name: Upload artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: aurora-pre-built.zip | |
path: | | |
aurora-linux-amd64.tar.gz | |
aurora-windows-amd64.tar.gz | |
aurora-darwin-amd64.tar.gz | |
aurora-freebsd-amd64.tar.gz | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_PAT }} | |
with: | |
tag_name: v2.1.0 | |
files: | | |
aurora-linux-amd64.tar.gz | |
aurora-windows-amd64.tar.gz | |
aurora-darwin-amd64.tar.gz | |
aurora-freebsd-amd64.tar.gz | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@v2 | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 1 | |
keep_minimum_runs: 8 |