From 6f85909b2ccfec0feec95577bff5683cf54824ae Mon Sep 17 00:00:00 2001 From: geekgeekrun-maintainer <166113191+geekgeekrun-maintainer@users.noreply.github.com> Date: Tue, 9 Apr 2024 06:13:46 +0000 Subject: [PATCH] update `Upload Release Asset` step in release ci workflow file --- .github/workflows/release-ui.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-ui.yml b/.github/workflows/release-ui.yml index c29c8e4..64a16c3 100644 --- a/.github/workflows/release-ui.yml +++ b/.github/workflows/release-ui.yml @@ -44,11 +44,24 @@ jobs: prerelease: false - name: Upload Release Asset - uses: actions/upload-release-asset@v1 + uses: actions/github-script@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./${{ secrets.ReleaseZipName }}.zip - asset_name: ${{ secrets.ReleaseZipName }}.zip - asset_content_type: application/zip \ No newline at end of file + script: | + const path = require('path'); + const fs = require('fs'); + const release_id = '${{ needs.create_release.outputs.id }}'; + const path_to_dist = `./packages/ui/dist` + for (let file of await fs.readdirSync(path_to_dist)) { + if (['.exe', '.deb', '.rpm', '.zip'].includes(path.extname(file))) { + console.log('uploadReleaseAsset', file); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: file, + data: await fs.readFileSync(`${path_to_dist}/${file}`) + }); + } + }