Skip to content
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

Merged
merged 3 commits into from
Jun 30, 2023
Merged

GHA to create a release #32

merged 3 commits into from
Jun 30, 2023

Conversation

khawkins
Copy link
Collaborator

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.

@khawkins khawkins requested a review from a team as a code owner June 29, 2023 23:17
name: Create GitHub Release for Extension Package

on:
workflow_dispatch:
Copy link
Collaborator Author

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.

- name: Build VSIX Package
run: npx vsce package

- name: Get package version
Copy link
Collaborator Author

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.

const packageName = packageJson.name;
const packageVersion = packageJson.version;
const vsixFilename = `${packageName}-${packageVersion}.vsix`;
const uploadUrl = await github.rest.repos.uploadReleaseAsset({
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Comment on lines 39 to 40
return response.data.id;
- name: Attach VSIX package to release
Copy link
Collaborator

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.

Copy link
Collaborator Author

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!

Copy link
Collaborator

@sfdctaka sfdctaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@khawkins
Copy link
Collaborator Author

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.

@khawkins khawkins merged commit 0904097 into salesforce:main Jun 30, 2023
8 checks passed
@khawkins khawkins deleted the cut_release branch June 30, 2023 00:25

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.
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants