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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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.


jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Install dependencies
run: npm install

- name: Build VSIX Package
run: npx vsce package

- name: Create release
id: create_release
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const packageVersion = require('./package.json').version;
const response = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${packageVersion}`,
name: `Release ${packageVersion}`,
body: `Generating release for version ${packageVersion}`
});
return response.data.id;

- name: Attach VSIX package to release
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const packageJson = require('./package.json');
const packageName = packageJson.name;
const packageVersion = packageJson.version;
const vsixFilename = `${packageName}-${packageVersion}.vsix`;
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ steps.create_release.outputs.result }},
name: vsixFilename,
data: fs.readFileSync(vsixFilename)
});
32 changes: 16 additions & 16 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Instructions to package this as an extension (*.vsix) file:
# Releasing the Mobile Extension

1. Install vsce
## Validating the release package locally, before publishing

```
npm install -g @vscode/vsce
```
Before publishing the extension, you'll want to test the "built" extension package locally, as the bundling and packaging workflow creates an extension whose code is structured quite differently from what you work with in a local development environment, and as such unforeseen issues could show up that otherwise wouldn't with local development.

2. Install dependencies
The following instructions will create the extension package (`salesforcedx-vscode-mobile-<version>.vsix`) locally:

NOTE: The packaging steps prunes the node_modules tree, so running `npm install` will reinstall dev dependencies.
1. Install the repository package

```
npm install
```
npm install

3. Create package
2. Create the VSIX package

```
vsce package
```
npx vsce package

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!


TODO: Eventually we can sign and publish it directly to marketplace.
3. Install the generated .vsix file and test as you will:

code --install-extension salesforcedx-vscode-mobile-<version>.vsix

## Publishing the extension package

Publishing of the package will be handled as GitHub Action initiated by a user responsible for publishing the package, once all testing and sign-off has occurred on the generated package.
Loading