This commit is contained in:
spiritlhl 2024-05-01 09:28:07 +00:00
parent 2c053e718b
commit e2466cf330

View File

@ -9,21 +9,6 @@ on:
types: [published]
jobs:
delete-assets:
name: Delete Existing Release Assets
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Delete Existing Release Assets
run: |
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/backtrace/releases/tags/output" | jq -r '.id')
echo "Deleting existing release assets..."
assets=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/oneclickvirt/backtrace/releases/$release_id/assets" | jq -r '.[] | .id')
for asset in $assets; do
echo "Deleting asset with ID: $asset"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/backtrace/releases/assets/$asset"
done
build:
name: Build and Test
runs-on: ubuntu-latest
@ -41,6 +26,15 @@ jobs:
run: |
go build -v ./...
go test -v ./...
- name: Delete Existing Release Assets
run: |
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/backtrace/releases/tags/output" | jq -r '.id')
echo "Deleting existing release assets..."
assets=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/oneclickvirt/backtrace/releases/$release_id/assets" | jq -r '.[] | .id')
for asset in $assets; do
echo "Deleting asset with ID: $asset"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/backtrace/releases/assets/$asset"
done
release-binary:
name: Release Go Binary