diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 278a4fda..2947ec28 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -250,35 +250,12 @@ jobs: clean_old_assets: name: Clean Old Release Assets - runs-on: ubuntu-latest needs: [check_commit, update_tag] if: ${{ needs.check_commit.outputs.should_run == 'true' && needs.update_tag.result == 'success' }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Remove old assets from release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - # Use consistent values from check_commit job - CURRENT_AUTOBUILD_VERSION="${{ needs.check_commit.outputs.autobuild_version }}" - LAST_TAURI_COMMIT="${{ needs.check_commit.outputs.last_tauri_commit }}" - - echo "📦 Current autobuild version: $CURRENT_AUTOBUILD_VERSION" - echo "📝 Last Tauri commit: $LAST_TAURI_COMMIT" - - # Get all assets and remove old ones - assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true) - for asset in $assets; do - # Keep assets that match current autobuild version or are non-versioned files (like latest.json) - if [[ "$asset" == *"$CURRENT_AUTOBUILD_VERSION"* ]] || [[ "$asset" == "latest.json" ]]; then - echo "🔒 Keeping current asset: $asset" - else - echo "🗑️ Deleting old asset: $asset" - gh release delete-asset "$TAG_NAME" "$asset" -y || echo "⚠️ Failed to delete $asset" - fi - done + uses: ./.github/workflow/clean-old-assets.yml + with: + tag_name: ${{ env.TAG_NAME }} + dry_run: false autobuild-x86-windows-macos-linux: name: Autobuild x86 Windows, MacOS and Linux diff --git a/.github/workflows/clean-old-assets.yml b/.github/workflows/clean-old-assets.yml index fdcf40e2..d6c7e35c 100644 --- a/.github/workflows/clean-old-assets.yml +++ b/.github/workflows/clean-old-assets.yml @@ -13,6 +13,18 @@ on: required: false default: false type: boolean + workflow_call: + inputs: + tag_name: + description: "Release tag name to clean (default: autobuild)" + required: false + default: "autobuild" + type: string + dry_run: + description: "Dry run mode (only show what would be deleted)" + required: false + default: false + type: boolean permissions: write-all