Skip to content

Commit

Permalink
Remove old release assets in GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
PichuChen committed Jul 30, 2024
1 parent 4f85643 commit fc923a6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ jobs:
- name: Test
run: go test -v ./...

- name: Remove Old ReleaseAsset
run: |
RELEASE_ID=`curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/PichuChen/hatsuaki/releases/tags/nightly | jq '.id'`
ASSETS_ID=`curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/PichuChen/hatsuaki/releases/$RELEASE_ID/assets | jq '.[].id'`
for id in $ASSETS_ID; do
curl -X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/PichuChen/hatsuaki/releases/assets/$id
done
- name: Upload Release Asset
run: |
RELEASE_ID=`curl -L \
Expand Down

0 comments on commit fc923a6

Please sign in to comment.