@@ -24,29 +24,24 @@ jobs:
24
24
- name : Clone the repository
25
25
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26
26
27
- - name : Update embedded version numbers
27
+ - name : Check embedded version numbers
28
28
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
39
34
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}"
40
41
41
42
- name : Create the release
42
43
run : |
43
44
gh release create "${GITHUB_REF_NAME}" --fail-on-no-commits --notes-from-tag --verify-tag \
44
45
--draft # FIXME
45
46
env :
46
47
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