From 6f2429e559b398b6e8e1b9ee3f5e32b7998edcae Mon Sep 17 00:00:00 2001 From: mario4tier Date: Fri, 20 Dec 2024 23:01:11 -0500 Subject: [PATCH] Fix --- .github/workflows/release-step-1.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-step-1.yml b/.github/workflows/release-step-1.yml index 43d77573..0fb77c35 100644 --- a/.github/workflows/release-step-1.yml +++ b/.github/workflows/release-step-1.yml @@ -80,6 +80,7 @@ jobs: let tag_name = process.env.TAG; console.log(`tag_name: ${tag_name}`); let upload_url; + let release_id; try { // Check if the release already exists @@ -98,7 +99,7 @@ jobs: } // Update the release to point to potentially new commit (noop when no change) - const release_id = release.id; + release_id = release.id; release = await github.rest.repos.updateRelease({ owner: context.repo.owner, repo: context.repo.repo, @@ -135,8 +136,10 @@ jobs: prerelease: false, }); if (response.status >= 200 && response.status < 300 && response.data.upload_url) { - console.log(`Draft release created with tag [${tag_name}]`); + console.log(`updateRelease result: ${JSON.stringify(response, null, 2)}`); upload_url = response.data.upload_url; + release_id = response.data.id; + console.log(`Draft release created with tag [${tag_name}]`); } else { core.setFailed(`Failed to create release with tag [${tag_name}] Status: ${response.status}`); return; @@ -148,18 +151,21 @@ jobs: } console.log(`upload_url: ${upload_url}`); + console.log(`release_id: ${release.id}`); core.setOutput("upload_url", upload_url); - name: Attach assets uses: actions/github-script@v7 env: UPLOAD_URL: ${{ steps.release_vars.outputs.upload_url }} + RELEASE_ID: ${{ steps.release_vars.outputs.release_id }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: script: | const fs = require('fs'); const path = require('path'); const upload_url = process.env.UPLOAD_URL; + const release_id = process.env.RELEASE_ID; const dist_dir = path.join(process.env.GITHUB_WORKSPACE, 'dist'); const files = fs.readdirSync(dist_dir);