-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (60 loc) · 2.21 KB
/
update-latest.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Update latest
on:
workflow_dispatch:
workflow_run:
workflows:
- Base Image
types:
- completed
jobs:
update-latest:
name: Rebuild release images
runs-on: ubuntu-latest
steps:
- name: Find latest tag
uses: actions/github-script@v7
with:
# need different token, RELEASE_TOKEN belongs to digineobot
github-token: ${{ secrets.RELEASE_TOKEN }}
script: |
const { data: { tag_name: releaseTag } } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
})
console.log(`latest release tag name: ${releaseTag}`)
const { data: { object: { sha: releaseRef } } } = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${releaseTag}`,
})
console.log(`latest release commit: ${releaseRef}`)
const { data: { object: { sha: masterRef } } } = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'heads/master',
})
console.log(`master release commit: ${masterRef}`)
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: releaseTag,
inputs: {
goreleaser: 'false',
releaseType: 'release',
}
})
console.log(`triggered release for ${releaseTag} (${releaseRef})`)
if (releaseRef !== masterRef) {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: 'master',
inputs: {
goreleaser: 'false',
releaseType: 'dev',
}
})
console.log(`triggered dev-release for master (${masterRef})`)
}