Skip to content

Commit

Permalink
Merge pull request #23 from 1Password/jh/auto-publish
Browse files Browse the repository at this point in the history
Set up workflow to automatically publish release on new tags
  • Loading branch information
jodyheavener authored Jun 21, 2022
2 parents f2c10a9 + 789ff01 commit ec2f690
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 10 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish extension
on:
push:
tags:
- v*

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install --frozen-lockfile
- name: Publish to Visual Studio Marketplace
id: publishToVsm
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
yarn: true
- name: Create Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
generate_release_notes: true
files: ${{ steps.publishToVsm.outputs.vsixPath }}
token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 18 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This is an extension for Visual Studio Code, please refer to the [Extension API](https://code.visualstudio.com/api) documentation.

Requires [Node](https://nodejs.org/en/), [VS Code](https://code.visualstudio.com/), and [vsce](https://github.com/microsoft/vscode-vsce) installed globally.
Requires [Node](https://nodejs.org/en/) and [VS Code](https://code.visualstudio.com/).

### Dependencies

Expand Down Expand Up @@ -70,27 +70,35 @@ yarn test -t="returns the custom fields"

## Distribution

### Building & Packaging
### Publishing the extension

When you want to build and package up the extension for creating a release, run the following:
We have a Workflow set up to automatically create a new release of the extension on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=1Password.op-vscode) and [GitHub](https://github.com/1Password/op-vscode/releases) whenever a new version tag is pushed.

You should only need to do the following on the `main` branch:

```shell
vsce package
# Replace VERSION with the version you are bumping to
yarn version --new-version VERSION && git push
```

This will run `yarn build` to create a minified version of the extension, and then package it up into a file called `op-vscode-[version].vsix`. This is just a ZIP file with a fancy extension, but with it anyone can install the extension manually by going to the Extension panel, opening the context menu, and clicking "Install from VSIX...".
This will:

### Publishing
1. Update the `version` property in `package.json`
2. Commit this version change
3. Create a new version tag
4. Push the commit and tag to the remote

To publish a new version of the extension, first make sure you are logged into the publisher account used for publishing new releases via `vsce login 1Password`.
Afterward the Workflow will take over, publishing the extension's new version to the VS Code Marketplace and creating a new GitHub Release.

Bump up the version in `package.json`, then run:
### Manual builds

If you need to build and package up the extension for manual distribution outside of regular publishing, first install [vsce](https://github.com/microsoft/vscode-vsce) globally, and then run the following:

```shell
vsce publish
vsce package
```

This will create a new version of the extension on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=1Password.op-vscode).
This will run `yarn build` to create a minified version of the extension, and then package it up into a file called `op-vscode-[version].vsix`. This is just a ZIP file with a fancy extension, but with it anyone can install the extension manually by going to the Extension panel, opening the context menu, and clicking "Install from VSIX...".

## Acknowledgments

Expand Down

0 comments on commit ec2f690

Please sign in to comment.