Skip to content

Commit

Permalink
Automatically update the latest tag to the HEAD on master.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Apr 3, 2024
1 parent ce24790 commit 0a91fa4
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/update-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update latest tag

on:
push:
branches:
- master
paths:
- '**.go'
- 'go.**'
- .github/workflows/update-tag.yaml

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Create latest
uses: actions/github-script@v7
with:
script: |
# Deletion no-ops if it's not already there.
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/latest',
sha: context.sha
}).catch(err => {
# We use create rather than update, because this ensures that the
# 'latest' tag is actually pushed to trigger the publication job.
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/latest',
sha: context.sha
});
})

0 comments on commit 0a91fa4

Please sign in to comment.