Skip to content

Commit 50a37b8

Browse files
[wip] [ci] add infrastructure for automated releases/publish to npm (latest)
Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
1 parent d1616c4 commit 50a37b8

File tree

6 files changed

+72
-3
lines changed

6 files changed

+72
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
release:
9+
types:
10+
- published
811

912
jobs:
1013

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: NPM package (next)
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
build:
7+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'eclipse-cdt-cloud/theia-trace-extension'
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
# Setup .npmrc file to publish to npm
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: '18'
15+
registry-url: 'https://registry.npmjs.org'
16+
- run: yarn
17+
- run: yarn publish:latest:ci
18+
env:
19+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

.github/workflows/publish-next.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
with:
1616
node-version: '18'
1717
registry-url: 'https://registry.npmjs.org'
18-
# Defaults to the user or organization that owns the workflow file
19-
scope: '@theia-ide'
2018
- run: yarn
2119
- run: yarn publish:next
2220
env:

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Create GitHub Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'RELEASE'
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- master
13+
paths:
14+
- 'RELEASE'
15+
16+
jobs:
17+
gh-release:
18+
name: GitHub release
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- uses: pipe-cd/actions-gh-release@v2.6.0
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 re-trigger the main workflow
31+
# and result in publishing the package to npm.
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+

RELEASE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tag: v0.0.0
2+
3+
commitInclude:
4+
parentOfMergeCommit: true
5+
6+
releaseNoteGenerator:
7+
showAbbrevHash: true
8+
showCommitter: false

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
"lint": "lerna run lint",
2020
"lint:fix": "lerna run lint:fix",
2121
"test": "lerna run test --",
22-
"publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push",
22+
"publish:latest:ci": "lerna publish from-git --registry=https://registry.npmjs.org/ --exact --no-push --yes",
23+
"publish:latest:manual": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push --yes",
2324
"publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary minor --preid=next.$(date -u '+%Y%m%d%H%M%S').$(git rev-parse --short HEAD) --dist-tag=next --no-git-tag-version --no-push --yes",
25+
"version:major": "lerna version major --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Major)\"",
26+
"version:minor": "lerna version minor --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Minor)\"",
27+
"version:patch": "lerna version patch --exact --no-push --git-tag-command /usr/bin/true --yes -m \"Release %s (Patch)\"",
2428
"format:write": "lerna run format:write",
2529
"format:check": "lerna run format:check",
2630
"browser": "yarn -s --cwd examples/browser",

0 commit comments

Comments
 (0)