Skip to content

CI: update the release workflow #20

CI: update the release workflow

CI: update the release workflow #20

Workflow file for this run

# yamllint disable rule:line-length
---
name: Release
on:
push:
tags:
- v*.*.*
permissions:
contents: read
concurrency:
group: release
cancel-in-progress: true
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Update embedded version numbers
run: |
sed -E -i "/uses:/s/v[0-9]+\\.[0-9]+\\.[0-9]+/${GITHUB_REF_NAME}/" README.md
jq --arg v "${GITHUB_REF_NAME#v}" '.version = $v' package.json >package.json.tmp && mv package.json.tmp package.json
if [[ -n "$(git diff --stat)" ]]; then
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor }}@users.noreply.github.com'
git add README.md package.json
git commit --message "Bump version to ${GITHUB_REF_NAME}" || :
git push origin 'HEAD:${{ github.event.repository.default_branch }}'
git tag --force "${GITHUB_REF_NAME}" HEAD
git push origin "${GITHUB_REF_NAME}" --force
fi
- name: Create the release
run: |
gh release create "${GITHUB_REF_NAME}" --fail-on-no-commits --notes-from-tag --verify-tag \
--draft # FIXME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: false # FIXME
name: Move the major version tag
run: |-
git tag --force "${GITHUB_REF_NAME%%.*}" "${GITHUB_REF_NAME}^{}"
git push origin "${GITHUB_REF_NAME%%.*}" --force