Publish latest #2
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: Publish latest | |
on: | |
workflow_run: | |
workflows: [Unit tests] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
create-latest: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Create or update latest | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/latest' | |
sha: context.sha | |
}).catch(err => { | |
if (err.status !== 422) throw err; | |
github.rest.git.updateRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'tags/latest' | |
sha: context.sha | |
}); | |
}) | |
- name: Create latest release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: 'latest' | |
tag_name: 'ref/tags/latest' | |
publish: | |
runs-on: ubuntu-latest | |
needs: create-latest | |
strategy: | |
matrix: | |
os: [ linux, darwin ] | |
arch: [ amd64, arm64 ] | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Publish binaries | |
uses: wangyoucao577/go-release-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
goos: ${{ matrix.os }} | |
goarch: ${{ matrix.arch }} | |
release_tag: latest | |
asset_name: SewerRat-${{ matrix.os }}-${{ matrix.arch }} | |
overwrite: true | |
compress_assets: false |