From 6193994cfe13c8842134dc84c7b68b2a22ac1ee4 Mon Sep 17 00:00:00 2001 From: hantmac Date: Wed, 6 Nov 2024 15:52:24 +0800 Subject: [PATCH] fix --- .github/workflows/release.yaml | 35 +++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 98f48d7..ed4f644 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -85,31 +85,48 @@ jobs: name: sha256sums-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }} path: ./_bin/sha256-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.txt retention-days: 1 - upload-sha256sums-plugin: + upload-sha256sums: needs: build_and_upload runs-on: ubuntu-latest - name: upload-sha256sums steps: - - name: Checkout - uses: actions/checkout@v4 - name: Get release id: get_release uses: bruceadams/get-release@v1.2.2 - name: Download sha256sums - uses: actions/download-artifact@v4.1.7 + uses: actions/download-artifact@v4 with: pattern: sha256sums-* merge-multiple: true - path: sha256sums - - shell: bash + - name: Combine sha256sums run: | - cat sha256sums/*.txt > sha256sums.txt + cat sha256-*.txt > sha256sums.txt + - name: Delete existing sha256sums + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const release = await github.rest.repos.getReleaseByTag({ + owner: context.repo.owner, + repo: context.repo.repo, + tag: '${{ github.ref_name }}' + }); + for (const asset of release.data.assets) { + if (asset.name === 'sha256sums.txt') { + await github.rest.repos.deleteReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + asset_id: asset.id + }); + console.log('Deleted existing sha256sums.txt'); + break; + } + } - name: Upload Checksums uses: actions/upload-release-asset@v1.0.2 with: upload_url: ${{ steps.get_release.outputs.upload_url }} asset_path: sha256sums.txt - asset_name: sha256sums-${{ steps.get_release.outputs.tag_name }}.txt + asset_name: sha256sums.txt asset_content_type: text/plain - name: Update kubectl plugin version in krew-index uses: rajatjindal/krew-release-bot@v0.0.43