Skip to content

Commit 869e166

Browse files
authored
Add GitHub action for next releases (#62)
1 parent 8a04e85 commit 869e166

File tree

7 files changed

+78
-25
lines changed

7 files changed

+78
-25
lines changed

.github/workflows/publish.yml .github/workflows/publish-latest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish
1+
name: Publish `latest`
22

33
permissions:
44
id-token: write
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
publish:
12-
name: Typir Publish
12+
name: Typir Publish `latest`
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 20
1515
steps:

.github/workflows/publish-next.yml

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

RELEASE.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Release Process
22

3+
## `latest` releases
4+
35
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.
46

57
1. Pull the latest changes from the main branch
@@ -17,3 +19,21 @@ The release process is mostly automated and requires running only a few commands
1719
```
1820

1921
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).
22+
23+
24+
## `next` releases
25+
26+
The release process for `next` releases is different from the `latest` releases. We configured a GitHub action to publish the `next` packages. It has to be called manually (it is a `workflow_dispatch`). This will release the current state of `main`. Follow these steps to release a `next` version:
27+
28+
1. Go to the Actions tab of your repository.
29+
2. On the left there is a list of workflow. Click the one the title "Publish `next`".
30+
3. A blue ribbon will appear, stating `This workflow has a workflow_dispatch event trigger.`.
31+
4. Click the button `Run workflow` from the ribbon.
32+
5. A popup will appear, asking you for which branch you want to run the workflow. Select `main` and click the button `Run workflow`.
33+
34+
Hint: What happens behind the scene is:
35+
36+
1. the action calls `npm run version:next` for each workspace package
37+
2. then it calls `npm run version:dependencies` to update the dependencies
38+
3. then it calls `npm run publish:next` to publish the updated packages
39+
4. the action discards everything, no changes will be committed or pushed

package-lock.json

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

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"eslint": "~8.57.1",
4141
"eslint-plugin-header": "~3.1.1",
4242
"fs-extra": "^11.2.0",
43+
"semver": "^7.7.1",
4344
"shx": "~0.3.4",
4445
"typescript": "~5.5.4",
4546
"vitest": "~2.1.2"

packages/typir-langium/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
"build": "tsc",
3939
"watch": "tsc --watch",
4040
"lint": "eslint src test --ext .ts",
41-
"publish:next": "npm --no-git-tag-version version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\" && npm publish --tag next",
42-
"publish:latest": "npm publish --tag latest --access public"
41+
"version:next": "npm --no-git-tag-version version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\"",
42+
"publish:latest": "npm publish --tag latest --access public",
43+
"publish:next": "npm publish --tag next"
4344
},
4445
"repository": {
4546
"type": "git",

packages/typir/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
"build": "tsc",
3939
"watch": "tsc --watch",
4040
"lint": "eslint src test --ext .ts",
41-
"publish:next": "npm --no-git-tag-version version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\" && npm publish --tag next",
42-
"publish:latest": "npm publish --tag latest --access public"
41+
"version:next": "npm --no-git-tag-version version \"$(npx semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\"",
42+
"publish:latest": "npm publish --tag latest --access public",
43+
"publish:next": "npm publish --tag next"
4344
},
4445
"repository": {
4546
"type": "git",

0 commit comments

Comments
 (0)