mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
* fix(ci): a test build's files outlive the catalog that names them, and a merged PR's build lasts until Preview carries it - A new push's PR release keeps the previous push's files until the catalog names the new ones, then five minutes more, so a download started from the old catalog still finds its APK. The app also reloads the catalog and retries once when a test build's download fails. - Closing a PR without merging still deletes its test build. A merged PR's build stays, and stays listed, until the newest Preview build was built from a main holding the merge, or three days pass (docs-only merges build no Preview). Main's build, the PR cleanup and the sweep share one script for this. * fix(ci): name the current push's APK in the catalog and prune nothing it still names * fix(ci): only a Preview with every APK carries a merge or is offered * fix(ci): publish no preview while none has every APK * test(ci): build_catalog publishes no preview while its APKs are uploading
69 lines
2.1 KiB
YAML
69 lines
2.1 KiB
YAML
name: PR Release Cleanup
|
|
run-name: remove PR
|
|
|
|
|
|
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [ closed ]
|
|
branches: [ main ]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: pr-release-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: false
|
|
queue: max
|
|
|
|
jobs:
|
|
cleanup:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Check the current PR state
|
|
id: state
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
set -euo pipefail
|
|
state=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq .state)
|
|
echo "closed=$([ "$state" = closed ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
|
|
- uses: actions/create-github-app-token@v2
|
|
if: ${{ steps.state.outputs.closed == 'true' }}
|
|
id: ci-token
|
|
with:
|
|
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
|
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
|
owner: Droid-Deck
|
|
repositories: DroidDeck-CI
|
|
- uses: actions/checkout@v4
|
|
if: ${{ steps.state.outputs.closed == 'true' }}
|
|
with:
|
|
ref: main
|
|
persist-credentials: false
|
|
- name: Delete the test build unless main still needs it
|
|
if: ${{ steps.state.outputs.closed == 'true' }}
|
|
env:
|
|
SOURCE_GITHUB_TOKEN: ${{ github.token }}
|
|
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
# A merged PR's build stays until a Preview build carries the merge; build.yml and the sweep remove it then.
|
|
run: python3 tools/release/retire_test_builds.py --pr "$PR_NUMBER"
|
|
- name: Retire the Discord PR announcement
|
|
if: ${{ steps.state.outputs.closed == 'true' }}
|
|
env:
|
|
WEBHOOK: ${{ secrets.DISCORD_PR_BUILDS_WEBHOOK }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: python3 tools/release/pr_discord.py retire
|
|
|
|
catalog:
|
|
needs: cleanup
|
|
if: ${{ always() }}
|
|
uses: ./.github/workflows/update-catalog.yml
|
|
secrets: inherit
|