Skip to content

Commit 043b932

Browse files
committed
fix(ci): rebase before pushing release manifest changes
also allow specified track in bump-patch to trigger an update if it changed Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent f7cdd93 commit 043b932

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

.github/workflows/build-fcash2-upload-android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ jobs:
129129
git add .well-known/release-manifest.json
130130
git diff --cached --quiet && echo "No changes to commit" && exit 0
131131
git commit -m "build: update release manifest"
132+
git pull --rebase https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git code/cash
132133
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:code/cash
133134
134135
- name: Upload build artifacts

.github/workflows/bump-patch.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@ jobs:
4747
run: bash scripts/update-release-manifest.sh
4848

4949
- name: Commit & Push changes
50-
if: steps.manifest.outputs.prod_changed == 'true' || steps.manifest.outputs.forced == 'true'
51-
uses: actions-js/push@master
52-
with:
53-
message: >-
54-
${{ steps.manifest.outputs.prod_changed == 'true'
55-
&& format('build: release Flipcash {0} ({1}), bump to {2}', steps.manifest.outputs.new_prod_name, steps.manifest.outputs.new_prod, steps.manifest.outputs.version)
56-
|| format('build: bump Flipcash to {0}', steps.manifest.outputs.version) }}
57-
branch: "code/cash"
58-
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
50+
if: steps.manifest.outputs.manifest_changed == 'true' || steps.manifest.outputs.prod_changed == 'true' || steps.manifest.outputs.forced == 'true'
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
53+
run: |
54+
git config user.name "github-actions[bot]"
55+
git config user.email "github-actions[bot]@users.noreply.github.com"
56+
git add -A
57+
COMMIT_MSG="${{ steps.manifest.outputs.prod_changed == 'true'
58+
&& format('build: release Flipcash {0} ({1}), bump to {2}', steps.manifest.outputs.new_prod_name, steps.manifest.outputs.new_prod, steps.manifest.outputs.version)
59+
|| (steps.manifest.outputs.forced == 'true'
60+
&& format('build: bump Flipcash to {0}', steps.manifest.outputs.version)
61+
|| 'build: update release manifest') }}"
62+
git commit -m "$COMMIT_MSG"
63+
git pull --rebase https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git code/cash
64+
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:code/cash

scripts/update-release-manifest.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ emit "old_prod" "${OLD_PROD:-null}"
142142
emit "new_prod" "${NEW_PROD:-null}"
143143
emit "new_prod_name" "${NEW_PROD_NAME:-null}"
144144

145+
# --- detect whether any track changed ---
146+
if diff -q <(jq -S .tracks "$MANIFEST_PATH") <(echo "$EXISTING" | jq -S '.tracks // {}') >/dev/null 2>&1; then
147+
emit "manifest_changed" "false"
148+
else
149+
emit "manifest_changed" "true"
150+
fi
151+
145152
# --- decide whether to bump patch ---
146153
PROD_CHANGED=false
147154
if in_list "production" "$TRACKS" && [ "${OLD_PROD:-null}" != "${NEW_PROD:-null}" ]; then

0 commit comments

Comments
 (0)