Skip to content

Commit 4233ecd

Browse files
committed
Update workflows from templates.
1 parent 60a06d3 commit 4233ecd

File tree

1 file changed

+25
-42
lines changed

1 file changed

+25
-42
lines changed

.github/workflows/bump-version.yaml

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,30 @@ jobs:
3838
git config --global user.name "Leeroy Travis"
3939
4040
'
41-
- name: Get version
42-
id: current
43-
run: echo "version=$(.github/bump-version.get.sh)" >> "$GITHUB_OUTPUT"
44-
- name: Compute versions
45-
id: versions
46-
run: .github/bump-version.bump.sh "${{ env.MODE }}" "${{ steps.current.outputs.version
47-
}}" ${{ github.event.inputs.version }}
48-
- name: Set release version
49-
run: '.github/bump-version.set.sh "${{ steps.versions.outputs.release }}"
50-
51-
git diff --cached
52-
53-
'
54-
- name: Commit release
55-
run: 'git commit -m "${COMMIT_PREFIX}Set release version ${{ steps.versions.outputs.release
56-
}}"
57-
58-
'
59-
- name: Tag release
60-
run: 'git tag "${{ steps.versions.outputs.release }}"
61-
62-
'
63-
- name: Push release tag
64-
run: 'git push origin "${{ github.ref }}"
65-
66-
git push origin "${{ steps.versions.outputs.release }}"
67-
68-
'
41+
- name: Release
42+
id: release
43+
run: "set -x\nRETRIES=10\nTRY=0\nwhile [ $TRY -lt $RETRIES ] ; do\n TRY=$(expr\
44+
\ $TRY + 1)\n # Get the current version.\n CURRENT=$(.github/bump-version.get.sh)\n\
45+
\ # Calculate next release version, and next dev version. Output to $GITHUB_OUTPUT,\
46+
\ which we then read.\n .github/bump-version.bump.sh \"${{ env.MODE }}\"\
47+
\ \"${CURRENT}\" ${{ github.event.inputs.version }}\n . $GITHUB_OUTPUT\n\
48+
\ # Set the in-tree version to the release version.\n .github/bump-version.set.sh\
49+
\ \"${release}\"\n git diff --cached\n # GHA intermixes the stdout from\
50+
\ git diff with stderr from \"set -x\", so we pause to let it settle.\n sleep\
51+
\ 1\n git commit -m \"${COMMIT_PREFIX}Set release version ${release}\"\n\
52+
\ git tag \"${release}\"\n\n # Bump to the next development version.\n \
53+
\ .github/bump-version.set.sh \"${bumped}\"\n git diff --cached\n sleep\
54+
\ 1\n git commit -m \"${COMMIT_PREFIX}Bump to next development version ${bumped}\"\
55+
\n\n # If we push the release commit and its tag in one step, we hit strange\
56+
\ race conditions where one client succeeds\n # pushing the tag, and another\
57+
\ client succeeds pushing the commit. Instead, we push the commit first and\
58+
\ then the tag.\n # That seems to cause the loser of the race to fail early.\n\
59+
\ if git push origin \"${{ github.ref }}\" && git push origin \"${release}\"\
60+
\ ; then\n break\n fi\n\n # If the \"git push\" failed, then let's forget\
61+
\ our last two commits, re-pull the latest changes, and try again.\n git\
62+
\ reset --hard HEAD~2\n git tag -d \"${release}\"\n git pull origin \"${{\
63+
\ github.ref }}\"\n # Wait a little bit to let competing workflows finish\
64+
\ their business.\n sleep 10\ndone\n"
6965
- name: Generate release text
7066
id: release-body
7167
run: "set -x\n# Get the most recent commit. Hopefully it was a PR merge.\nCOMMIT=$(jq\
@@ -84,18 +80,5 @@ jobs:
8480
with:
8581
token: ${{ secrets.WORKFLOW_PAT }}
8682
prerelease: true
87-
tag: ${{ steps.versions.outputs.release }}
83+
tag: ${{ steps.release.outputs.release }}
8884
body: ${{ steps.release-body.outputs.body }}
89-
- name: Set development version
90-
run: '.github/bump-version.set.sh "${{ steps.versions.outputs.bumped }}"
91-
92-
git diff --cached
93-
94-
'
95-
- name: Commit and push development version
96-
run: 'git commit -m "${COMMIT_PREFIX}Bump to next development version ${{ steps.versions.outputs.bumped
97-
}}"
98-
99-
git push origin main
100-
101-
'

0 commit comments

Comments
 (0)