Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Dec 21, 2024
1 parent 260738f commit 6f2429e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/release-step-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 6f2429e

Please sign in to comment.