Skip to content

Commit

Permalink
Create a release process (#36)
Browse files Browse the repository at this point in the history
* Copied deployment config from Langium
* Add "Update versions" script
* Add publish GH action
* Run `npm pkg fix`
  • Loading branch information
Lotes authored Nov 18, 2024
1 parent 857339a commit 038aebe
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 178 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish

permissions:
id-token: write

on:
release:
types: [published]

jobs:
publish:
name: Typir Publish
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Build
shell: bash
run: |
npm ci
npm run clean
npm run build
- name: Test
if: success() || failure()
shell: bash
run: |
npm run test:run
- name: Publish NPM Packages
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Update the following list when a new npm package is added
run: |
npm run publish:latest --provenance --workspace=typir
npm run publish:latest --provenance --workspace=typir-langium
19 changes: 19 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Release Process

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.

1. Pull the latest changes from the main branch
2. Create a new branch
3. Uplift the package versions by running `npm version major|minor|patch --no-git-tag-version --workspaces`
4. Update the dependency versions by running `npm run version:dependencies`
5. Create a PR with your updated changes, get a review and merge it
6. Create a version tag on the latest commit on main and push it

```bash
git checkout main
git pull origin main
git tag <version-tag>
git push origin <version-tag>
```

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).
7 changes: 4 additions & 3 deletions examples/lox/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "lox",
"name": "typir-example-lox",
"displayName": "lox",
"version": "0.0.1",
"description": "Please enter a brief description here",
"private": true,
"description": "",
"author": {
"name": "TypeFox",
"url": "https://www.typefox.io"
Expand Down Expand Up @@ -74,6 +75,6 @@
],
"main": "./out/extension/main.cjs",
"bin": {
"ox-cli": "./out/cli/main.js"
"ox-cli": "out/cli/main.js"
}
}
19 changes: 10 additions & 9 deletions examples/ox/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "ox",
"displayName": "Ox",
"name": "typir-example-ox",
"displayName": "ox",
"version": "0.0.1",
"description": "Please enter a brief description here",
"private": true,
"description": "",
"author": {
"name": "TypeFox",
"url": "https://www.typefox.io"
Expand All @@ -27,11 +28,11 @@
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.json --watch\" \"node esbuild.mjs --watch\""
},
"dependencies": {
"commander": "~12.1.0",
"langium": "~3.2.0",
"typir-langium": "~0.0.1",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver": "~9.0.1"
"commander": "~12.1.0",
"langium": "~3.2.0",
"typir-langium": "~0.0.1",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver": "~9.0.1"
},
"devDependencies": {
"@types/vscode": "~1.94.0",
Expand Down Expand Up @@ -74,6 +75,6 @@
],
"main": "./out/extension/main.cjs",
"bin": {
"ox-cli": "./out/cli/main.js"
"ox-cli": "out/cli/main.js"
}
}
39 changes: 28 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"langium:generate": "npm run langium:generate --workspace=examples/ox --workspace=examples/lox",
"langium:watch": "npm run langium:watch --workspace=examples/ox --workspace=examples/lox",
"vscode:prepublish": "npm run build && npm run lint",
"reset:repo": "git clean -f -X -d"
"reset:repo": "git clean -f -X -d",
"version:dependencies": "node ./scripts/update-version.js && npm install"
},
"devDependencies": {
"@types/node": "~18.19.55",
Expand All @@ -38,6 +39,7 @@
"esbuild": "~0.24.0",
"eslint": "~8.57.1",
"eslint-plugin-header": "~3.1.1",
"fs-extra": "^11.2.0",
"shx": "~0.3.4",
"typescript": "~5.5.4",
"vitest": "~2.1.2"
Expand Down
140 changes: 0 additions & 140 deletions packages/typir-langium/package-lock.json

This file was deleted.

Loading

0 comments on commit 038aebe

Please sign in to comment.