Skip to content

Commit 7a3e148

Browse files
committed
Update workflows from templates.
1 parent d7b4f83 commit 7a3e148

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

.github/workflows/bump-version.yaml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ name: Bump Version
1212
version:
1313
description: New semver release version.
1414
env:
15-
COMMIT_PREFIX: 'bump-version: '
1615
MODE: prerelease
1716
jobs:
18-
vars:
17+
skip:
1918
runs-on: ubuntu-22.04
2019
outputs:
21-
commit-prefix: ${{ steps.echo.outputs.commit-prefix }}
20+
skip: ${{ steps.skip.outputs.skip }}
2221
steps:
23-
- id: echo
24-
run: echo "commit-prefix=${{ env.COMMIT_PREFIX }}" >> "$GITHUB_OUTPUT"
22+
- name: Maybe skip
23+
id: skip
24+
run: "# If it's a push to main, and any of the commits are from Dependabot,\
25+
\ we should skip.\nif [ ${{ github.event_name }} = push ] ; then\n if [ $(jq\
26+
\ -r < ${{ github.event_path }} '.commits | map(.author.name == \"dependabot[bot]\"\
27+
) | any') = true ] ; then\n echo \"skip=true\" >> \"$GITHUB_OUTPUT\"\n\
28+
\ fi\nfi\n"
2529
bump:
2630
needs:
27-
- vars
31+
- skip
2832
runs-on: ubuntu-22.04
29-
if: '!contains(join(github.event.commits.*.message), needs.vars.outputs.commit-prefix)'
33+
if: ${{ needs.skip.outputs.skip != 'true' }}
3034
steps:
3135
- name: Checkout
3236
uses: actions/checkout@v3
@@ -48,20 +52,20 @@ jobs:
4852
\ # Set the in-tree version to the release version.\n .github/bump-version.set.sh\
4953
\ \"${release}\"\n git diff --cached\n # GHA intermixes the stdout from\
5054
\ 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"
55+
\ 1\n git commit -m \"Set release version ${release} [skip ci]\"\n git tag\
56+
\ \"${release}\"\n\n # Bump to the next development version.\n .github/bump-version.set.sh\
57+
\ \"${bumped}\"\n git diff --cached\n sleep 1\n git commit -m \"Bump to\
58+
\ next development version ${bumped} [skip ci]\"\n\n # If we push the release\
59+
\ commit and its tag in one step, we hit strange race conditions where one\
60+
\ client succeeds\n # pushing the tag, and another client succeeds pushing\
61+
\ the commit. Instead, we push the commit first and then the tag.\n # That\
62+
\ seems to cause the loser of the race to fail early.\n if git push origin\
63+
\ \"${{ github.ref }}\" && git push origin \"${release}\" ; then\n break\n\
64+
\ fi\n\n # If the \"git push\" failed, then let's forget our last two commits,\
65+
\ re-pull the latest changes, and try again.\n git reset --hard HEAD~2\n\
66+
\ git tag -d \"${release}\"\n git pull origin \"${{ github.ref }}\"\n #\
67+
\ Wait a little bit to let competing workflows finish their business.\n sleep\
68+
\ 10\ndone\n"
6569
- name: Generate release text
6670
id: release-body
6771
run: "set -x\n# Get the most recent commit. Hopefully it was a PR merge.\nCOMMIT=$(jq\

0 commit comments

Comments
 (0)