Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

ci: open a PR for update.json instead of pushing to main

Durganshu Mishra696081acafd7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9c47fb3..6883389 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -7,6 +7,8 @@ name: Release
# rolls the changelog's Unreleased section into a versioned one, and regenerates
# update.json (versionCode, versionName, downloadUrl, sha256, releaseNotes) — which is
# what devices actually read (via raw.githubusercontent.com) to detect the update.
+# That last file is landed by opening a PR, not by pushing to main, which main's
+# ruleset forbids: the release is only visible to devices once that PR is squash-merged.
on:
push:
branches: [main]
@@ -31,6 +33,7 @@ jobs:
timeout-minutes: 30
permissions:
contents: write
+ pull-requests: write
steps:
- uses: actions/checkout@v4
with:
@@ -325,10 +328,47 @@ jobs:
echo "Published asset verified: $PUBLISHED"
rm -f published.apk
- - name: Commit update.json and CHANGELOG.md
+ # main's ruleset requires a pull request and verified signatures, so this job
+ # cannot push to it directly (a run that tries is rejected with GH013 after the
+ # release is already published, leaving update.json advertising the old version
+ # and the update invisible to devices). Push a branch and open a PR instead.
+ # Squash-merging it has GitHub create a single web-flow-signed commit, which is
+ # what satisfies the signature rule — the commit made here is not signed.
+ - name: Open PR with update.json and CHANGELOG.md
if: steps.check.outputs.should_release == 'true' && steps.check.outputs.dry_run != 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ TAG: ${{ steps.version.outputs.tag }}
run: |
+ BRANCH="release/$TAG-manifest"
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
rm -f release_notes.md
git add update.json CHANGELOG.md
- git commit -m "chore: update.json for ${{ steps.version.outputs.tag }}"
- git push origin HEAD:main
+ git commit -m "chore: update.json for $TAG"
+ # Force-push so re-running after a failed attempt reuses the same branch.
+ git push --force origin "HEAD:refs/heads/$BRANCH"
+
+ if gh pr view "$BRANCH" --json number >/dev/null 2>&1; then
+ echo "PR for $BRANCH already exists - updated it with the new commit."
+ else
+ cat > pr_body.md <<EOF
+ $TAG is tagged and published, but devices only see the update once
+ \`update.json\` lands on \`main\`. Squash-merge this PR to finish the release.
+
+ Squash specifically: the commit on this branch is unsigned, and squashing has
+ GitHub create a single web-flow-signed commit, which is what satisfies main's
+ \`required_signatures\` rule.
+
+ Generated by the [release workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID).
+ EOF
+ gh pr create --base main --head "$BRANCH" --title "chore: update.json for $TAG" --body-file pr_body.md
+ rm -f pr_body.md
+ fi
+
+ {
+ echo "### $TAG published"
+ echo ""
+ echo "The APK is live, but the update is **not yet visible to devices**."
+ echo "Squash-merge $(gh pr view "$BRANCH" --json url --jq .url) to land update.json."
+ } >> "$GITHUB_STEP_SUMMARY"