Skip to content

Update latest

Update latest #32

Workflow file for this run

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 { owner, repo } = context.repo
const { data: allTags } = await github.rest.git.getMatchingRef({
owner,
repo,
ref: 'tags/v',
})
const { ref, object: { sha: releaseRef } } = allTags[allTags.length - 1],
releaseTag = ref.substring(11)
console.log(`latest release: ${releaseTag}, ${releaseRef}`)
const { data: { object: { sha: masterRef } } } = await github.rest.git.getRef({
owner,
repo,
ref: 'heads/master',
})
console.log(`master release commit: ${masterRef}`)
await github.rest.actions.createWorkflowDispatch({
owner,
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,
repo,
workflow_id: 'release.yml',
ref: 'master',
inputs: {
goreleaser: false,
releaseType: 'dev',
}
})
console.log(`triggered dev-release for master (${masterRef})`)
}