-
Notifications
You must be signed in to change notification settings - Fork 6
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
GHA to create a release #32
Conversation
name: Create GitHub Release for Extension Package | ||
|
||
on: | ||
workflow_dispatch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we could do here, which is currently hard-coded below, is give an input field to the workflow, that would allow the initiating user to create the description associated with the GitHub Release. Could be a nice way to make the "release notes" applicable to each release. Easy to do.
.github/workflows/create_release.yml
Outdated
- name: Build VSIX Package | ||
run: npx vsce package | ||
|
||
- name: Get package version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realizing after doing more of this script, that I could just inline this specific step to the "Create release" step below. I'll make that update, as I think that will be cleaner.
.github/workflows/create_release.yml
Outdated
const packageName = packageJson.name; | ||
const packageVersion = packageJson.version; | ||
const vsixFilename = `${packageName}-${packageVersion}.vsix`; | ||
const uploadUrl = await github.rest.repos.uploadReleaseAsset({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do we need uploadUrl
if we're not returning its property, something like we co in Create Release
with return response.data.id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. No. I had started this script anticipating more steps to come after, then didn't do that. I'll take it out.
.github/workflows/create_release.yml
Outdated
return response.data.id; | ||
- name: Attach VSIX package to release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit nit: Missing newline since other steps are delineated by single line space in between.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I was just counting on the code formatting to fix that kind of stuff for me! I guess not. 😆 Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Gonna merge this and see if it works. It worked in a sandbox environment I used for coding it up, so 🤞. Happy to make iterations as we go. |
|
||
4. Manually install the generated .vsix file and smoke test. | ||
**NOTE:** The packaging workflow prunes the dev dependencies out of the `node_modules/` tree, so you'll need to re-run `npm install` to reinstall dev dependencies and continue development work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to remove this since other PR removes the pruning now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thanks. 😊 Yeah, I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I just realized I already merged this. I'll get it in the open one!
First step to publishing! This creates a GitHub Action that will be manually triggered from the Actions tab. When run, this action will create a GitHub release on the repo, based on the package version in
package.json
. It will then build the VSIX package, and attach that package to the release as an artifact.