Skip to content

Commit 7e5d724

Browse files
committed
CI: update the release workflow
1 parent 6a6b91d commit 7e5d724

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,24 @@ jobs:
2424
- name: Clone the repository
2525
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2626

27-
- name: Update embedded version numbers
27+
- name: Check embedded version numbers
2828
run: |
29-
sed -E -i "/uses:/s/v[0-9]+\\.[0-9]+\\.[0-9]+/${GITHUB_REF_NAME}/" README.md
30-
jq --arg v "${GITHUB_REF_NAME#v}" '.version = $v' package.json >package.json.tmp && mv package.json.tmp package.json
31-
if [[ -n "$(git diff --stat)" ]]; then
32-
git config user.name '${{ github.actor }}'
33-
git config user.email '${{ github.actor }}@users.noreply.github.com'
34-
git add README.md package.json
35-
git commit --message "Bump version to ${GITHUB_REF_NAME}" || :
36-
git push origin 'HEAD:${{ github.event.repository.default_branch }}'
37-
git tag --force "${GITHUB_REF_NAME}" HEAD
38-
git push origin "${GITHUB_REF_NAME}" --force
29+
version="$(grep -F "uses: ${GITHUB.REPOSITORY}@" README.md | cut -d@ -f2)"
30+
if [[ ${version} != "${GITHUB_REF_NAME}" ]]; then
31+
line="$(grep -Fn "uses: ${GITHUB.REPOSITORY}@" README.md | cut -d: -f1)"
32+
printf '::error file=README.md,line=%d::version does not match tag\n' "${line}"
33+
rc=1
3934
fi
35+
if [[ $(jq -r .version package.json) != "${GITHUB_REF_NAME}" ]]; then
36+
line="$(grep -Fn '"version":' package.json | cut -d: -f1)"
37+
printf '::error file=package.json,line=%d::version does not match tag\n' "${line}"
38+
rc=1
39+
fi
40+
exit "${rc:-0}"
4041
4142
- name: Create the release
4243
run: |
4344
gh release create "${GITHUB_REF_NAME}" --fail-on-no-commits --notes-from-tag --verify-tag \
4445
--draft # FIXME
4546
env:
4647
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
48-
- if: false # FIXME
49-
name: Move the major version tag
50-
run: |-
51-
git tag --force "${GITHUB_REF_NAME%%.*}" "${GITHUB_REF_NAME}^{}"
52-
git push origin "${GITHUB_REF_NAME%%.*}" --force

0 commit comments

Comments
 (0)