-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically update the latest tag to the HEAD on master.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||
}); | ||
}) | ||