Skip to content

Commit 7a112eb

Browse files
eriedclaude
andcommitted
CI: drop prior APKs from rolling release before each upload
action-gh-release attaches new files but never deletes the older commit's APK, so the rolling pre-release was accumulating one APK per push (four on the external-gps tag before this fix). Adds a step that, when the release already exists, walks every .apk asset on the tag and deletes it before the new build uploads its single artifact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fd8cf0e commit 7a112eb

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/branch-apk.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ jobs:
105105
path: app/build/outputs/apk/debug/app-debug.apk
106106
retention-days: 90
107107

108+
- name: Strip prior APKs from rolling release
109+
if: github.event_name != 'pull_request'
110+
env:
111+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
run: |
113+
# action-gh-release attaches new files but doesn't remove the previous
114+
# commit's APK; without this step the rolling pre-release accumulates
115+
# one APK per push. Delete every existing .apk on the tag before the
116+
# next step uploads the freshly built one. Tolerate the tag not
117+
# existing yet (first run on a brand-new branch).
118+
tag="${{ steps.meta.outputs.tag }}"
119+
if gh release view "$tag" >/dev/null 2>&1; then
120+
gh release view "$tag" --json assets \
121+
--jq '.assets[] | select(.name | endswith(".apk")) | .name' \
122+
| while read -r asset; do
123+
[ -n "$asset" ] && gh release delete-asset "$tag" "$asset" --yes || true
124+
done
125+
fi
126+
108127
- name: Replace rolling pre-release with new APK
109128
if: github.event_name != 'pull_request'
110129
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)