From 76a67c2fe1998085e23e852f1a03b650b4c5deee Mon Sep 17 00:00:00 2001 From: sdcb Date: Fri, 20 Dec 2024 13:22:48 +0800 Subject: [PATCH] upload both 7z/zip in github actions --- .github/workflows/build-container.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index a4905adc..e61cd983 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -348,9 +348,10 @@ jobs: name: ${{ matrix.asset }} path: ${{ matrix.asset }} - - name: Compress artifacts into 7z + - name: Compress artifacts run: | 7z a ${{ matrix.asset }}.7z ${{ matrix.asset }} + zip -r ${{ matrix.asset }}.zip ${{ matrix.asset }} shell: bash - name: Upload Asset @@ -358,17 +359,20 @@ jobs: with: script: | const fs = require('fs'); - const assetPath = './${{ matrix.asset }}.7z'; + const assetNames = [ '${{ matrix.asset }}.7z', '${{ matrix.asset }}.zip' ]; const releaseId = "${{ needs.create-release.outputs.release_id }}"; - const asset = fs.readFileSync(assetPath); - await github.rest.repos.uploadReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: releaseId, - name: '${{ matrix.asset }}.7z', - data: asset, + const promises = assetNames.map(assetName => { + const asset = fs.readFileSync('./' + assetName); + return github.rest.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: releaseId, + name: assetName, + data: asset, + }); }); + await Promise.all(promises); env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}