chore: release 1.0 (#84) #181
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 Binaries | |
on: [push] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: 'Build Assets' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build: [linux_amd64, windows_amd64, darwin_amd64, darwin_arm64] | |
include: | |
- build: linux_amd64 | |
goos: linux | |
goarch: amd64 | |
ext: '' | |
- build: windows_amd64 | |
goos: windows | |
goarch: amd64 | |
ext: '.exe' | |
- build: darwin_amd64 | |
goos: darwin | |
goarch: amd64 | |
ext: '' | |
- build: darwin_arm64 | |
goos: darwin | |
goarch: arm64 | |
ext: '' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# We need all tags | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
check-latest: true | |
- name: Build | |
run: | | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./scripts/build_generator | |
mv main${{ matrix.ext }} autometrics${{ matrix.ext }} | |
- name: Pack (Zip) | |
run: | | |
zip autometrics-${{ matrix.build }}.zip -v -z autometrics${{ matrix.ext }} | |
- name: Upload (Zip) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: autometrics ${{ matrix.build }} | |
path: autometrics-${{ matrix.build }}.zip | |
if-no-files-found: error | |
retention-days: 7 | |
add_assets: | |
name: 'Add Assets' | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Fetch Linux (AMD64) build | |
uses: actions/download-artifact@v3 | |
with: | |
name: autometrics linux_amd64 | |
- name: Fetch Windows (AMD64) build | |
uses: actions/download-artifact@v3 | |
with: | |
name: autometrics windows_amd64 | |
- name: Fetch Darwin (AMD64) build | |
uses: actions/download-artifact@v3 | |
with: | |
name: autometrics darwin_amd64 | |
- name: Fetch Darwin (ARM64) build | |
uses: actions/download-artifact@v3 | |
with: | |
name: autometrics darwin_arm64 | |
- name: Release with Notes | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |