From e2466cf33004de057f39161eb51203fd82573205 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Wed, 1 May 2024 09:28:07 +0000 Subject: [PATCH] update --- .github/workflows/main.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a794368..b9191ad 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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