Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,46 @@ jobs:
--repo "${REPO}" \
--draft=false

update-floating-tag:
runs-on: 'ubuntu-latest'
needs:
- 'create-release'
steps:
- name: 'Update floating tag'
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7
env:
RELEASE_VERSION: 'v${{ needs.create-release.outputs.version }}'
REPO: '${{ github.repository }}'
with:
github-token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
script: |-
const tag = process.env.RELEASE_VERSION;
const major = tag.split(".")[0];
const githubActionsRef = `${process.env.REPO}@${major}`

// Try to update the ref first. If that fails, it probably does not
// exist yet, and we should create it.
try {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/" + major,
sha: context.sha,
force: true,
});
core.info(`Updated ${githubActionsRef} to ${context.sha} (${tag})`);
} catch (err) {
core.warning(`Failed to create tag ${major}: ${err}`);

await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/" + major,
sha: context.sha,
});
core.info(`Created ${githubActionsRef} at ${context.sha} (${tag})`);
}

cleanup-failed-release:
if: |-
${{ always() && needs.create-release.outputs.created == 'true' && contains(fromJSON('["failure", "cancelled", "skipped"]'), needs.publish-release.result) }}
Expand Down