-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚦 Add experimental promotion process
It's not, strictly-speaking, "ideal" for me to be `--force` pushing changes to `master` to check for CI. It'd be much better to have a process which either manually does promotion, or automates promotion so that `master` can always be in a building state. This makes some changes to attempt that by triggering builds on `develop` that, on successful builds, automatically push the changes to `master` instead. This allows a consistent `develop` branch without the need to break `master` all the time.
- Loading branch information
1 parent
1022cfc
commit 37e8fbc
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Promote to master | ||
on: | ||
push: | ||
branches: [develop] | ||
|
||
jobs: | ||
verify: | ||
name: Verify build integrity | ||
uses: ./.github/workflows/build.yaml | ||
|
||
promote: | ||
name: Promote to Master | ||
runs-on: ubuntu-latest | ||
if: success() | ||
needs: | ||
- verify | ||
steps: | ||
- name: Checkout develop | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Push | ||
id: update-branch | ||
run: | | ||
echo "new_sha1=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}" | ||
git fetch origin master | ||
git checkout master | ||
echo "old_sha1=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}" | ||
git reset --hard develop | ||
git push origin master | ||
- name: Summarize Success | ||
if: success() | ||
run: | | ||
sha1=$(git rev-parse --short HEAD) | ||
echo "# ⏩ Accepted changes from `develop` into `master`" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "${sha1} is the new HEAD of `master`" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "## Summary" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "Below are commits being promoted" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "" >> "${GITHUB_STEP_SUMMARY}" | ||
old_sha1=${{steps.update-branch.outputs.old_sha1}} | ||
new_sha1=${{steps.update-branch.outputs.new_sha1}} | ||
echo "| SHA1 | Message |" >> "${GITHUB_STEP_SUMMARY}" | ||
git log \ | ||
--pretty="format:| %h | %s |" \ | ||
--no-show-signature \ | ||
${old_sha1}..${new_sha1} >> "${GITHUB_STEP_SUMMARY}" | ||
- name: Summarize Failure | ||
if: failure() | ||
run: | | ||
sha1=$(git rev-parse --short HEAD) | ||
echo "# 🛑 Rejected changes from `develop` into `master`" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "" >> "${GITHUB_STEP_SUMMARY}" | ||
echo "A failure occurred, and `master` was not able to be updated" >> "${GITHUB_STEP_SUMMARY}" |