-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1001 Bytes
/
update-tag.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
});
})