From bf0f3e97d5c1261757c74488aeae5859b7ceb99f Mon Sep 17 00:00:00 2001 From: Jody Heavener Date: Sat, 18 Jun 2022 15:55:38 -0300 Subject: [PATCH 1/2] Set up workflow to automatically publish release on new tags --- .github/workflows/publish.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c569651 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }} From 789ff01b2cd2dfaa9e4f37ac1e729b15b0845c18 Mon Sep 17 00:00:00 2001 From: Jody Heavener Date: Sat, 18 Jun 2022 16:23:39 -0300 Subject: [PATCH 2/2] Update contributing doc with note on how to publish --- CONTRIBUTING.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14e25b7..770e7ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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