Skip to content

Commit 119d8d5

Browse files
[ci] harmonize release doc, add helper scripts
Make this repo more similar to our other cdt-cloud repos: - install lerna as a devDependency, use repo root as the single lerna workspace - provide package.json helper scripts that use "lerna version", to help step the version and create the release commit - document release process in root README-dev - prevent triggering release-related jobs on forks Signed-off-by: Marc Dumais <[email protected]>
1 parent e6b5f30 commit 119d8d5

File tree

6 files changed

+3233
-91
lines changed

6 files changed

+3233
-91
lines changed

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
os: [ubuntu-latest]
7171
node-version: [18]
7272
# Only execute when the trigger was a tag (new release)
73-
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
73+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-cdt-cloud/vscode-trace-server'
7474

7575
steps:
7676
- uses: actions/checkout@v4
@@ -103,7 +103,7 @@ jobs:
103103
os: [ubuntu-latest]
104104
node-version: [18]
105105
# Only execute when the trigger was a tag (new release)
106-
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
106+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-cdt-cloud/vscode-trace-server'
107107

108108
steps:
109109
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
name: Create or prepare GitHub release
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
paths:
8-
- 'RELEASE'
9-
pull_request:
10-
types: [opened, synchronize]
11-
branches:
12-
- main
13-
paths:
14-
- 'RELEASE'
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'RELEASE'
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- main
13+
paths:
14+
- 'RELEASE'
1515

1616
jobs:
17-
gh-release:
18-
name: GitHub release
19-
runs-on: ubuntu-latest
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
- uses: pipe-cd/[email protected]
26-
with:
27-
release_file: 'RELEASE'
28-
# Actions that run using the auto-generated GitHub token are
29-
# not allowed to trigger a new workflow run. In this case we want
30-
# the tag created by actions-gh-release to trigger the main workflow
31-
# and result in publishing the extension to open-vsx.
32-
# The following scopes are required when creating the committer token:
33-
# - repo:status, repo_deployment, public_repo, read:org
34-
# See here for more details:
35-
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
36-
token: ${{ secrets.GH_COMMITTER_TOKEN }}
37-
17+
gh-release:
18+
name: GitHub release
19+
if: github.repository == 'eclipse-cdt-cloud/vscode-trace-server'
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- uses: pipe-cd/[email protected]
27+
with:
28+
release_file: 'RELEASE'
29+
# Actions that run using the auto-generated GitHub token are
30+
# not allowed to trigger a new workflow run. In this case we want
31+
# the tag created by actions-gh-release to trigger the main workflow
32+
# and result in publishing the extension to open-vsx.
33+
# The following scopes are required when creating the committer token:
34+
# - repo:status, repo_deployment, public_repo, read:org
35+
# See here for more details:
36+
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
37+
token: ${{ secrets.GH_COMMITTER_TOKEN }}
38+

README-dev.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,37 @@ yarn format:write
9898

9999
```
100100

101+
## Release/publish
102+
103+
We use GitHub CI to create a GitHub release and the corresponding git tag, and also to publish this repo's VSCode extension to the `open-vsx.org` and the `Visual Studio Marketplace` registries.
104+
105+
### Triggering a new release
106+
107+
Whenever a new release is desired, it can be triggered through a PR, as per the following:
108+
109+
Create a new branch for your PR, based on the repo's latest state. e.g.
110+
111+
```bash
112+
git branch new-release && git checkout new-release
113+
```
114+
115+
Then decide if the release shall be a `Major`, `Minor` or `Patch` release and use the corresponding command below to step the package's versions, according to the release type. A new release commit will be created:
116+
117+
``` bash
118+
yarn version:major
119+
# or
120+
yarn version:minor
121+
# or
122+
yarn version:patch
123+
```
124+
125+
Modify the _version tag_ in file `./RELEASE`, to match the new release. Amend the release commit to include this change:
126+
127+
```bash
128+
git add RELEASE && git commit --amend
129+
```
130+
131+
Finally, push the branch to the main repository (not a fork!) and use it to create a PR. When the PR is merged, a GitHub release should be created with auto-generated release notes, as well as a git tag. Then the `publish-*` CI jobs should trigger, and if everything goes well, publish the new version of the extension to both registries.
101132

102133
[backlog]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/issues/15
103134
[blueprint]: https://theia-ide.org/docs/blueprint_download

lerna.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "0.2.1",
3+
"npmClient": "yarn",
4+
"command": {
5+
"run": {
6+
"stream": true
7+
}
8+
},
9+
"packages": [
10+
"."
11+
]
12+
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
"format:write": "prettier --write ./src",
7676
"format:check": "prettier --check ./src",
7777
"test": "node ./out/test/runTest.js",
78+
"version:major": "lerna version major --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Major)\"",
79+
"version:minor": "lerna version minor --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Minor)\"",
80+
"version:patch": "lerna version patch --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Patch)\"",
7881
"license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json",
7982
"license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review"
8083
},
@@ -94,6 +97,7 @@
9497
"@vscode/vsce": "^2.20.1",
9598
"eslint": "8.43.0",
9699
"glob": "^8.1.0",
100+
"lerna": "^7.0.0",
97101
"mocha": "^10.2.0",
98102
"prettier": "2.8.8",
99103
"ts-loader": "^9.4.2",

0 commit comments

Comments
 (0)