diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6faeaec..c5d5514 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,8 +18,6 @@ env: GH_TOKEN: ${{ github.token }} PIP_DISABLE_PIP_VERSION_CHECK: 1 -permissions: write-all - jobs: prep: runs-on: windows-latest @@ -148,7 +146,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: src_dists + name: dists_src path: dist/ binary_dists: @@ -182,13 +180,14 @@ jobs: - name: Upload to Artifacts uses: actions/upload-artifact@v4 with: - name: bin_dists + name: dists_bin_${{ matrix.python }}_${{ matrix.platform }} path: dist/ github_release: name: "GitHub Release" runs-on: ubuntu-latest needs: [source_dists, prep] + permissions: write-all steps: - name: Checkout uses: actions/checkout@v4 @@ -196,12 +195,32 @@ jobs: - name: Download Artifacts uses: actions/download-artifact@v4 with: - name: src_dists + name: dists_src path: dist - name: Remove Prior Release - run: gh release delete "${{ needs.prep.outputs.tag }}" - continue-on-error: true + uses: actions/github-script@v7 + env: + TAG_NAME: ${{ needs.prep.outputs.tag }} + with: + # noinspection TypeScriptUnresolvedReference + script: | + const tag = process.env.TAG_NAME + const release = await github.rest.repos.getReleaseByTag({ + owner: context.repo.owner, + repo: context.repo.repo, + tag: tag + }) + if (release.id == undefined) { // Not found + core.info(`No release with tag ${tag}.`) + } else { + await github.rest.repos.deleteRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release.id + }) + core.notice(`Deleted prior github release: ${tag}`) + } - name: Create Release run: gh release create "${{ needs.prep.outputs.tag }}" --verify-tag --title "${{ needs.prep.outputs.tag }}" --notes "${{ needs.prep.outputs.message }}" --draft @@ -228,7 +247,7 @@ jobs: - name: Download Artifacts uses: actions/download-artifact@v4 with: - pattern: "*dists" + pattern: "dists*" path: dist merge-multiple: true