|
6 | 6 | workflow_dispatch: |
7 | 7 |
|
8 | 8 | permissions: |
9 | | - actions: write |
10 | 9 | contents: write |
11 | 10 |
|
12 | 11 | jobs: |
|
41 | 40 | UPDATE_MANIFEST_URL: https://github.com/${{ github.repository }}/releases/download/app-latest/app-manifest.json |
42 | 41 | run: nix develop --command ./gradlew assembleRelease |
43 | 42 |
|
44 | | - - name: Upload Debug APK |
45 | | - uses: actions/upload-artifact@v4 |
46 | | - with: |
47 | | - name: debug-apk-${{ github.sha }} |
48 | | - path: app/build/outputs/apk/debug/*.apk |
49 | | - retention-days: 7 |
50 | | - |
51 | | - - name: Upload Release APK |
52 | | - uses: actions/upload-artifact@v4 |
53 | | - with: |
54 | | - name: release-apk-${{ github.sha }} |
55 | | - path: app/build/outputs/apk/release/*.apk |
56 | | - retention-days: 7 |
57 | | - |
58 | 43 | - name: Publish rolling app-latest release |
59 | 44 | if: github.ref == 'refs/heads/main' |
60 | 45 | env: |
|
92 | 77 | --prerelease \ |
93 | 78 | dist/app.apk \ |
94 | 79 | dist/app-manifest.json |
95 | | -
|
96 | | - cleanup: |
97 | | - runs-on: [self-hosted, nix] |
98 | | - needs: build |
99 | | - steps: |
100 | | - - uses: actions/github-script@v7 |
101 | | - with: |
102 | | - script: | |
103 | | - const artifacts = await github.rest.actions.listArtifactsForRepo({ |
104 | | - owner: context.repo.owner, |
105 | | - repo: context.repo.repo, |
106 | | - per_page: 100, |
107 | | - }); |
108 | | - const now = Date.now(); |
109 | | - const sevenDays = 7 * 24 * 60 * 60 * 1000; |
110 | | - for (const artifact of artifacts.data.artifacts) { |
111 | | - const created = new Date(artifact.created_at).getTime(); |
112 | | - if (now - created > sevenDays) { |
113 | | - await github.rest.actions.deleteArtifact({ |
114 | | - owner: context.repo.owner, |
115 | | - repo: context.repo.repo, |
116 | | - artifact_id: artifact.id, |
117 | | - }); |
118 | | - console.log(`Deleted old artifact: ${artifact.name}`); |
119 | | - } |
120 | | - } |
0 commit comments