Skip to content

Commit 038aebe

Browse files
authored
Create a release process (#36)
* Copied deployment config from Langium * Add "Update versions" script * Add publish GH action * Run `npm pkg fix`
1 parent 857339a commit 038aebe

File tree

10 files changed

+152
-178
lines changed

10 files changed

+152
-178
lines changed

.github/workflows/publish.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish
2+
3+
permissions:
4+
id-token: write
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
publish:
12+
name: Typir Publish
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 20
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Use Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '18.x'
22+
registry-url: 'https://registry.npmjs.org'
23+
- name: Build
24+
shell: bash
25+
run: |
26+
npm ci
27+
npm run clean
28+
npm run build
29+
- name: Test
30+
if: success() || failure()
31+
shell: bash
32+
run: |
33+
npm run test:run
34+
- name: Publish NPM Packages
35+
shell: bash
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
# Update the following list when a new npm package is added
39+
run: |
40+
npm run publish:latest --provenance --workspace=typir
41+
npm run publish:latest --provenance --workspace=typir-langium

RELEASE.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Release Process
2+
3+
The release process is mostly automated and requires running only a few commands. After commiting, pushing, tagging and releasing the changes, a GitHub Action will publish all npm packages.
4+
5+
1. Pull the latest changes from the main branch
6+
2. Create a new branch
7+
3. Uplift the package versions by running `npm version major|minor|patch --no-git-tag-version --workspaces`
8+
4. Update the dependency versions by running `npm run version:dependencies`
9+
5. Create a PR with your updated changes, get a review and merge it
10+
6. Create a version tag on the latest commit on main and push it
11+
12+
```bash
13+
git checkout main
14+
git pull origin main
15+
git tag <version-tag>
16+
git push origin <version-tag>
17+
```
18+
19+
7. Create a [GitHub release](https://github.com/TypeFox/typir/releases) from the new tag (this will trigger the Github Action and publish all artifacts automatically).

examples/lox/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"name": "lox",
2+
"name": "typir-example-lox",
33
"displayName": "lox",
44
"version": "0.0.1",
5-
"description": "Please enter a brief description here",
5+
"private": true,
6+
"description": "",
67
"author": {
78
"name": "TypeFox",
89
"url": "https://www.typefox.io"
@@ -74,6 +75,6 @@
7475
],
7576
"main": "./out/extension/main.cjs",
7677
"bin": {
77-
"ox-cli": "./out/cli/main.js"
78+
"ox-cli": "out/cli/main.js"
7879
}
7980
}

examples/ox/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"name": "ox",
3-
"displayName": "Ox",
2+
"name": "typir-example-ox",
3+
"displayName": "ox",
44
"version": "0.0.1",
5-
"description": "Please enter a brief description here",
5+
"private": true,
6+
"description": "",
67
"author": {
78
"name": "TypeFox",
89
"url": "https://www.typefox.io"
@@ -27,11 +28,11 @@
2728
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.json --watch\" \"node esbuild.mjs --watch\""
2829
},
2930
"dependencies": {
30-
"commander": "~12.1.0",
31-
"langium": "~3.2.0",
32-
"typir-langium": "~0.0.1",
33-
"vscode-languageclient": "~9.0.1",
34-
"vscode-languageserver": "~9.0.1"
31+
"commander": "~12.1.0",
32+
"langium": "~3.2.0",
33+
"typir-langium": "~0.0.1",
34+
"vscode-languageclient": "~9.0.1",
35+
"vscode-languageserver": "~9.0.1"
3536
},
3637
"devDependencies": {
3738
"@types/vscode": "~1.94.0",
@@ -74,6 +75,6 @@
7475
],
7576
"main": "./out/extension/main.cjs",
7677
"bin": {
77-
"ox-cli": "./out/cli/main.js"
78+
"ox-cli": "out/cli/main.js"
7879
}
7980
}

package-lock.json

+28-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"langium:generate": "npm run langium:generate --workspace=examples/ox --workspace=examples/lox",
2727
"langium:watch": "npm run langium:watch --workspace=examples/ox --workspace=examples/lox",
2828
"vscode:prepublish": "npm run build && npm run lint",
29-
"reset:repo": "git clean -f -X -d"
29+
"reset:repo": "git clean -f -X -d",
30+
"version:dependencies": "node ./scripts/update-version.js && npm install"
3031
},
3132
"devDependencies": {
3233
"@types/node": "~18.19.55",
@@ -38,6 +39,7 @@
3839
"esbuild": "~0.24.0",
3940
"eslint": "~8.57.1",
4041
"eslint-plugin-header": "~3.1.1",
42+
"fs-extra": "^11.2.0",
4143
"shx": "~0.3.4",
4244
"typescript": "~5.5.4",
4345
"vitest": "~2.1.2"

packages/typir-langium/package-lock.json

-140
This file was deleted.

0 commit comments

Comments
 (0)