Skip to content

Automatically update the latest tag to the HEAD on master. #5

Automatically update the latest tag to the HEAD on master.

Automatically update the latest tag to the HEAD on master. #5

Workflow file for this run

name: Update latest tag
on:
push:
branches:
- master
paths:
- '**.go'
- 'go.**'
- .github/workflows/update-tag.yaml
permissions:
contents: write
# We delete and re-create the tag to ensure that there's actually a push to
# trigger the publication action, rather than using the updateRef function.
# The deletion itself no-ops if it's not already there.
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Create latest
uses: actions/github-script@v7
with:
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/latest',
sha: context.sha
}).catch(err => {
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/latest',
sha: context.sha
});
})