Skip to content

Commit

Permalink
Add action to shift the 'latest' tag after a successful build.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Apr 3, 2024
1 parent ce24790 commit 3c2d53d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish latest

on:
workflow_run:
workflows: [Unit tests]
types:
- completed
workflow_dispatch:

jobs:
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

0 comments on commit 3c2d53d

Please sign in to comment.