-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Actions workflow for creating packages for releases #51
Comments
I'm going to call this It will be very similar to |
Weird that GitHub have archived their official action for this: https://github.com/actions/upload-release-asset |
From https://github.com/actions/upload-release-asset/blob/main/src/upload-release-asset.js it looks like I can do this using a |
Found a couple of examples using GitHub code search: |
I'm going to figure this out in my https://github.com/simonw/playing-with-actions repo. |
After a few iterations I managed to ship https://github.com/simonw/playing-with-actions/releases/tag/v4 using the code from https://github.com/simonw/playing-with-actions/blob/v4/.github/workflows/release.yml - in particular this script block: - uses: actions/github-script@v4
name: Upload release attachment
with:
script: |
const fs = require('fs');
const tag = context.ref.replace("refs/tags/", "");
console.log("tag = ", tag);
// Get release for this tag
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
});
console.log("release = ", release);
// Upload the release asset
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: "My.zip",
data: await fs.readFileSync("My.zip")
}); |
Follows #20 and #50 - when I create a release in this GitHub repo it should attach the resulting
.zip
file to the release.The text was updated successfully, but these errors were encountered: