Skip to content

Commit 7e8094f

Browse files
Update workflows from templates. (#98)
1 parent 8aa5b6c commit 7e8094f

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/bump-version.set.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ if [ "${NEWVERS/-*/}" = "0.0.0" ] ; then
2727
echo "Illegal zero version '${NEWVERS}'" 1>&2
2828
exit 1
2929
fi
30-
# Sanity check: Must be valid semver.
31-
if ! [[ ${NEWVERS} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]] ; then
30+
# Sanity check: Must start with a valid semver.
31+
if ! [[ ${NEWVERS} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))? ]] ; then
3232
echo "Invalid version '${NEWVERS}'" 1>&2
3333
exit 1
3434
fi

.github/workflows/update-workflows.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,20 @@ jobs:
8585
\ \"::set-output name=failed::false\"\nfi\n\necho \"Git status:\"\ngit status\n\
8686
\ngit add -A\n\nif [ -z \"$(git status --porcelain)\" ] ; then\n echo \"\
8787
No updated workflows; done.\"\n echo \"::set-output name=skip::true\"\nfi\n"
88-
- name: Commit and PR
88+
- name: Commit and push or PR
8989
working-directory: thisrepo
9090
if: steps.update.outputs.skip != 'true'
9191
run: "set -x\nset -o pipefail\ngit config --global user.email [email protected]\n\
92-
git config --global user.name \"Leeroy Travis\"\n\n# If we're on a PR branch,\
93-
\ push to it instead of making a new PR branch.\nif ! [ \"${{ github.ref }}\"\
94-
\ = \"refs/heads/main\" ] ; then\n git commit -m \"Update workflows from\
95-
\ templates.\"\n git push\n exit 0\nfi\n\nNEW_BRANCH=\"workflow-update-$(date\
96-
\ -u '+%Y-%m-%d')\"\ngit checkout -b \"${NEW_BRANCH}\"\ngit commit -m \"Update\
97-
\ workflows from templates.\"\ngit push -u origin \"${NEW_BRANCH}\"\n\n# Create\
98-
\ a PR.\nPRBODY=\"Updating from templates.\"\nif [ \"${{ steps.update.outputs.failed\
99-
\ }}\" == \"true\" ] ; then\n PRBODY=$(printf \"%s\\n\\n%s\" \"${PRBODY}\"\
100-
\ \"@IronCoreLabs/ops patch didn't apply cleanly.\")\nfi\n# https://github.com/IronCoreLabs/depot/issues/333\n\
92+
git config --global user.name \"Leeroy Travis\"\n\ngit commit -m \"Update\
93+
\ workflows from templates.\"\n\n# If the update applied cleanly, try pushing\
94+
\ straight to the branch we're on.\nif [ \"${{ steps.update.outputs.failed\
95+
\ }}\" = \"false\" ] && git push ; then\n exit 0\nfi\n\n# Simple push failed.\
96+
\ We don't care why it failed; we just need to make a PR out of this commit.\n\
97+
NEW_BRANCH=\"workflow-update-$(date -u '+%Y-%m-%d')\"\ngit branch \"${NEW_BRANCH}\"\
98+
\ngit push -u origin \"${NEW_BRANCH}\"\n\n# Create a PR.\nPRBODY=\"Updating\
99+
\ from templates.\"\nif [ \"${{ steps.update.outputs.failed }}\" == \"true\"\
100+
\ ] ; then\n PRBODY=$(printf \"%s\\n\\n%s\" \"${PRBODY}\" \"@IronCoreLabs/ops\
101+
\ patch didn't apply cleanly.\")\nfi\n# https://github.com/IronCoreLabs/depot/issues/333\n\
101102
echo \"${PRBODY}\" > body.txt\necho -n \"${NEW_BRANCH}\" > head.txt\necho\
102103
\ ${{ steps.update.outputs.failed }} | \\\njq --rawfile body body.txt --rawfile\
103104
\ head head.txt \\\n '{\"title\": \"Update workflows from templates\",\n\

0 commit comments

Comments
 (0)