From 8cb35f56c1bbeb93e15f8bc9851e51c70b745c8d Mon Sep 17 00:00:00 2001 From: Mirko Milovanovic Date: Mon, 10 Feb 2025 14:18:55 +0100 Subject: [PATCH] feat: update delete release assets action to use new delete-tag action --- .github/workflows/main.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd9e541..e536bdf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,13 +38,14 @@ jobs: - name: Check for PDF artifact run: file ${{ env.PDF_NAME }} || grep -q ' PDF ' - - name: Delete old release assets + - name: Delete latest release attachment for Tesi.pdf if: github.event_name == 'push' && github.ref == 'refs/heads/main' - uses: mknejp/delete-release-assets@v1 - with: - token: ${{ secrets.RELEASE_TOKEN }} - tag: latest - assets: ${{ env.PDF_NAME }} + run: | + latest_release_id=$(curl -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/api/v1/repos/${{ github.repository_owner }}/${{ github.repository }}/releases/tags/latest | jq -r '.id') + assets=$(curl -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/api/v1/repos/${{ github.repository_owner }}/${{ github.repository }}/releases/$latest_release_id/assets | jq -r '.[] | select(.name == "${{ env.PDF_NAME }}") | .id') + for asset_id in $assets; do + curl -X DELETE -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" https://gitea.kobim.cloud/api/v1/repos/${{ github.repository }}/releases/assets/$asset_id + done - name: Release PDF artifact if: github.event_name == 'push' && github.ref == 'refs/heads/main'