@@ -10,9 +10,31 @@ permissions:
1010 contents : write
1111 id-token : write
1212 attestations : write
13+ actions : write
1314
1415jobs :
16+ cleanup :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Delete old artifacts
20+ env :
21+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22+ run : |
23+ gh api repos/${{ github.repository }}/actions/artifacts \
24+ --paginate --jq '.artifacts[].id' | while read id; do
25+ gh api -X DELETE repos/${{ github.repository }}/actions/artifacts/$id || true
26+ done
27+ - name : Delete old caches
28+ env :
29+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30+ run : |
31+ gh api repos/${{ github.repository }}/actions/caches \
32+ --jq '.actions_caches[].id' | while read id; do
33+ gh api -X DELETE repos/${{ github.repository }}/actions/caches/$id || true
34+ done
35+
1536 test :
37+ needs : [cleanup]
1638 runs-on : ubuntu-latest
1739 steps :
1840 - uses : actions/checkout@v4
78100 with :
79101 name : purroxy-mac
80102 path : release/*.dmg
81- retention-days : 30
103+ retention-days : 1
82104
83105 build-win :
84106 needs : [test]
@@ -112,7 +134,7 @@ jobs:
112134 with :
113135 name : purroxy-win
114136 path : release/*.exe
115- retention-days : 30
137+ retention-days : 1
116138
117139 build-linux :
118140 needs : [test]
@@ -145,7 +167,7 @@ jobs:
145167 with :
146168 name : purroxy-linux
147169 path : release/*.AppImage
148- retention-days : 30
170+ retention-days : 1
149171
150172 release :
151173 needs : [build-mac, build-win, build-linux]
@@ -241,3 +263,17 @@ jobs:
241263 run : bash scripts/publish-npm.sh
242264 env :
243265 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
266+
267+ cleanup-after :
268+ needs : [release, publish-npm]
269+ if : always()
270+ runs-on : ubuntu-latest
271+ steps :
272+ - name : Delete artifacts from this run
273+ env :
274+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
275+ run : |
276+ gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
277+ --jq '.artifacts[].id' | while read id; do
278+ gh api -X DELETE repos/${{ github.repository }}/actions/artifacts/$id || true
279+ done
0 commit comments