@@ -12,21 +12,25 @@ name: Bump Version
12
12
version :
13
13
description : New semver release version.
14
14
env :
15
- COMMIT_PREFIX : ' bump-version: '
16
15
MODE : prerelease
17
16
jobs :
18
- vars :
17
+ skip :
19
18
runs-on : ubuntu-22.04
20
19
outputs :
21
- commit-prefix : ${{ steps.echo .outputs.commit-prefix }}
20
+ skip : ${{ steps.skip .outputs.skip }}
22
21
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.\n if [ ${{ 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\n fi\n "
25
29
bump :
26
30
needs :
27
- - vars
31
+ - skip
28
32
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' }}
30
34
steps :
31
35
- name : Checkout
32
36
uses : actions/checkout@v3
@@ -48,20 +52,20 @@ jobs:
48
52
\ # Set the in-tree version to the release version.\n .github/bump-version.set.sh\
49
53
\ \" ${release}\"\n git diff --cached\n # GHA intermixes the stdout from\
50
54
\ 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\n done\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\n done\n "
65
69
- name : Generate release text
66
70
id : release-body
67
71
run : " set -x\n # Get the most recent commit. Hopefully it was a PR merge.\n COMMIT=$(jq\
0 commit comments