v1.67.2 #237
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: | |
release: | |
types: | |
- created | |
env: | |
# e.g. v1.0.0 | |
TAG_NAME: ${{ github.event.release.tag_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
osarch: | |
- os: linux | |
arch: amd64 | |
- os: linux | |
arch: arm | |
- os: darwin | |
arch: amd64 | |
- os: darwin | |
arch: arm64 | |
- os: windows | |
arch: amd64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
# The API linter does not use these, but we need them to build the | |
# binaries. | |
# | |
# gox is a cross-compiler binary and needs to be install with `go install`. | |
# | |
# Mousetrap is a build dependency installed individually because it is | |
# only needed for the Windows build. Since we are building on Linux, it is | |
# not installed automatically as a dependency. | |
- name: Install the cross-platform build tool. | |
run: | | |
go install github.com/mitchellh/gox@latest | |
go get github.com/inconshreveable/mousetrap | |
- name: Build for the ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} platform. | |
run: | | |
CGO_ENABLED=0 gox -osarch ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} -output api-linter ./... && \ | |
tar cvfz api-linter.tar.gz api-linter* | |
- name: Set raw version | |
id: raw_tag | |
# Strips the 'v' from the actual semver version. | |
run: echo "raw_version=${TAG_NAME#v}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Upload the ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} release. | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./api-linter.tar.gz | |
asset_name: api-linter-${{ steps.raw_tag.outputs.raw_version }}-${{ matrix.osarch.os }}-${{ matrix.osarch.arch }}.tar.gz | |
asset_content_type: application/tar+gzip |