release-focus #324
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: Upload macOS binaries | |
env: | |
dev_tag: nightly | |
on: | |
repository_dispatch: | |
types: [release-focus] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go v1.21 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Write release version | |
run: | | |
VERSION=${{ github.event.client_payload.ref }} | |
echo Version: ${VERSION#v} | |
echo "VERSION=${VERSION#v}" >> $GITHUB_ENV | |
- name: Build assets with Goreleaser | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: latest | |
args: release --clean --snapshot --config=.goreleaser_darwin.yml | |
- name: Temporarily save build assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: darwin-artifacts | |
path: dist | |
retention-days: 1 | |
upload: | |
runs-on: macos-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Retrieve saved build assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: darwin-artifacts | |
path: dist | |
- name: Upload assets to latest release | |
if: github.event_name == 'repository_dispatch' | |
run: | | |
if [ ${{ github.event.client_payload.ref_type }} == 'branch' ]; then | |
gh release upload ${{ env.dev_tag }} dist/*.tar.gz dist/darwin-checksums.txt --clobber | |
else | |
gh release upload ${{ github.event.client_payload.ref }} dist/*.tar.gz dist/darwin-checksums.txt --clobber | |
fi | |
echo "${{ github.event.client_payload.ref }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger NPM Publish | |
uses: peter-evans/repository-dispatch@v2 | |
if: github.event.client_payload.ref_type == 'tag' | |
with: | |
event-type: release-focus-npm |