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.
feat: enhance release verification to check for existing tags and asset integrity
Durganshu Mishrab9ecde4fcda1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 89a9e1b..9c47fb3 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -51,6 +51,10 @@ jobs:- name: Skip if this version was already releasedid: check+ env:+ GH_TOKEN: ${{ github.token }}+ TAG: ${{ steps.version.outputs.tag }}+ NAME: ${{ steps.version.outputs.name }}run: |DRY_RUN=falseif [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.dry_run }}" = "true" ]; then@@ -59,15 +63,51 @@ jobs:echo "dry_run=$DRY_RUN" >> "$GITHUB_OUTPUT"if [ "$DRY_RUN" = "true" ]; then- echo "Dry run — building and verifying ${{ steps.version.outputs.tag }} without publishing."+ echo "Dry run — building and verifying $TAG without publishing."echo "should_release=true" >> "$GITHUB_OUTPUT"- elif git rev-parse -q --verify "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null; then- echo "Tag ${{ steps.version.outputs.tag }} already exists — versionName wasn't bumped, nothing to do."- echo "should_release=false" >> "$GITHUB_OUTPUT"- else+ exit 0+ fi++ if ! git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then+ echo "$TAG is new — proceeding with the release."echo "should_release=true" >> "$GITHUB_OUTPUT"+ exit 0fi+ # An existing tag normally means "already released, nothing to do". But a run+ # that died anywhere after `Create tag` also leaves a tag behind, and skipping+ # silently would let that half-finished state re-run green while devices still+ # see nothing. Only treat the tag as a no-op once the release is provably whole.+ echo "Tag $TAG already exists — verifying the release it points at is complete."+ FAILED=0+ note() { echo " - $1"; FAILED=1; }++ ASSET=$(gh release view "$TAG" --json assets \+ --jq '.assets[] | select(.name == "app-release.apk")' 2>/dev/null || true)+ if [ -z "$ASSET" ]; then+ note "no GitHub release for $TAG, or it carries no app-release.apk asset"+ fi++ MANIFEST_NAME=$(jq -r '.versionName' update.json)+ MANIFEST_SHA=$(jq -r '.sha256' update.json)+ if [ "$MANIFEST_NAME" != "$NAME" ]; then+ note "update.json advertises $MANIFEST_NAME, not $NAME — devices cannot see this release"+ fi+ if [ -n "$ASSET" ]; then+ ASSET_SHA=$(printf '%s' "$ASSET" | jq -r '.digest // ""' | sed 's/^sha256://')+ if [ -n "$ASSET_SHA" ] && [ "$ASSET_SHA" != "$MANIFEST_SHA" ]; then+ note "published asset sha256 ($ASSET_SHA) != update.json ($MANIFEST_SHA) — downloads would fail verification"+ fi+ fi++ if [ "$FAILED" = "1" ]; then+ echo "::error::$TAG was tagged but its release is incomplete (details above). Recover with: git push --delete origin $TAG && git tag -d $TAG && gh release delete $TAG --yes — then re-run."+ exit 1+ fi++ echo "$TAG is fully published and update.json matches it — nothing to do."+ echo "should_release=false" >> "$GITHUB_OUTPUT"+- name: Roll CHANGELOG.md Unreleased section into this versionif: steps.check.outputs.should_release == 'true'id: changelog