Skip to content

Commit

Permalink
Merge pull request #59 from kubeshop/f1ames/ci/release-job
Browse files Browse the repository at this point in the history
ci: introduce release job
  • Loading branch information
f1ames authored Nov 29, 2023
2 parents e717941 + 9c00077 commit 9336902
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
release:
runs-on: ubuntu-latest
env:
SEGMENT_API_KEY: ${{ secrets.SEGMENT_API_KEY }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 18

- run: npm i

- name: Propagate SEGMENT API key
run: printf "export const SEGMENT_API_KEY = '%s';\n" "$SEGMENT_API_KEY" > src/config.ts

- name: Publish to marketplace
id: publishPackage
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload extension package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.publishPackage.outputs.vsixPath }}
asset_name: monokle.vsix
asset_content_type: application/octet-stream
34 changes: 33 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,38 @@ And then using _Install from VSIX_ option in VSC.

## Releasing

Most of the release process is done automatically through GitHub CI. However it requires few manual steps:

1. Make sure you are on `main` branch and have latest changes and no local modifications:

```bash
git checkout main
git fetch --all
git reset --hard origin/main
```

2. Update `CHANGELOG.md` file and `Release Notes` section of `README.md` with release info (if needed) and push to `main` branch.

3. Run `npm version [patch|minor|major]` to bump package version and push (`main` and tag) to remote:

```bash
npm version patch
git push origin main
git push origin vA.B.C
```

Pushing a tag to remote triggers release process (see `release.yaml` workflow file), which publishes
to VSC marketplace and creates GitHub release.

You can verify the release by:

* Looking on the [Marketplace page](https://marketplace.visualstudio.com/items?itemName=kubeshop.monokle) to see if latest release is there.
* Looking on GitHub [release list](https://github.com/kubeshop/vscode-monokle/releases) to see if latest release is there.

### Manual publication

> If for any reason you need to release manually, see steps below.
Releasing requires [`@vscode/vsce`](https://www.npmjs.com/package/@vscode/vsce) package installed.

**IMPORTANT**: To keep telemetry working, before running any `vsce` command, please update `SEGMENT_API_KEY` in `src/config.ts` to correct value for a time of building the extension (DO NOT COMMIT THOUGH!).
Expand All @@ -61,4 +93,4 @@ Or `package` + `publish` (this allows to test packaged extension before publishi
```bash
vsce package [version] # patch, minor, major, A.B.C
vsce publish -i monokle-[version].vsix
```
```

0 comments on commit 9336902

Please sign in to comment.