Skip to content

Commit d2a7886

Browse files
committed
ci(github): prune stale nightly APKs from FTP latest folder after upload
This adds a post-upload cleanup step that removes old files from the nightly latest FTP destination, keeping only the current APK and tar — preventing accumulation of stale builds.
1 parent 092c908 commit d2a7886

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/shippable_builds.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,23 @@ jobs:
931931
destination: ${{ steps.prepare_ftp.outputs.FTP_DESTINATION_NIGHTLY_LATEST }}
932932
gzip: false
933933

934+
- name: Set up Cloud SDK for pruning
935+
if: ${{ !inputs.skipFtp && contains(matrix.releaseTarget, 'ftp') && matrix.packageFormat == 'apk' && needs.dump_config.outputs.releaseType == 'daily' }}
936+
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1
937+
938+
- name: Prune FTP Nightly Latest
939+
if: ${{ !inputs.skipFtp && contains(matrix.releaseTarget, 'ftp') && matrix.packageFormat == 'apk' && needs.dump_config.outputs.releaseType == 'daily' }}
940+
shell: bash
941+
env:
942+
FTP_DESTINATION_NIGHTLY_LATEST: ${{ steps.prepare_ftp.outputs.FTP_DESTINATION_NIGHTLY_LATEST }}
943+
PKG_FILE: ${{ steps.rename.outputs.PKG_FILE }}
944+
FTP_TAR_FILENAME: ${{ steps.generate_tar.outputs.FTP_TAR_FILENAME }}
945+
run: |
946+
gcloud storage ls "gs://${FTP_DESTINATION_NIGHTLY_LATEST}/" \
947+
| grep -vF "${PKG_FILE}" \
948+
| grep -vF "${FTP_TAR_FILENAME}" \
949+
| xargs -r gcloud storage rm
950+
934951
- name: Summary
935952
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
936953
id: summary

0 commit comments

Comments
 (0)