Skip to content

Use older runner images for builds (#131) #22

Use older runner images for builds (#131)

Use older runner images for builds (#131) #22

Workflow file for this run

name: Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
id: create_release
- id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
build:
strategy:
matrix:
target:
- os: 'macos-13'
goos: 'darwin'
goarch: 'amd64'
- os: 'macos-13'
goos: 'darwin'
goarch: 'arm64'
- os: 'ubuntu-20.04'
goos: 'linux'
goarch: 'amd64'
- os: 'windows-2019'
goos: 'windows'
goarch: 'amd64'
ext: '.exe'
go: [ '1.22' ]
runs-on: ${{ matrix.target.os }}
needs: [ release ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- if: matrix.target.goos == 'darwin' && matrix.target.goarch == 'arm64'
run: |
echo SDKROOT=$(xcrun --sdk macosx --show-sdk-path) >> $GITHUB_ENV
- run: go build -v -o ${{ matrix.target.goos }}-${{ matrix.target.goarch }} -ldflags="-X 'main.BuildVersion=${{ needs.release.outputs.version }}'" .
env:
GOOS: ${{ matrix.target.goos }}
GOARCH: ${{ matrix.target.goarch }}
CGO_ENABLED: 1
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url}} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ matrix.target.goos }}-${{ matrix.target.goarch }}
asset_name: alpaca_${{ needs.release.outputs.version }}_${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}
asset_content_type: application/zip