Skip to content

Commit b5fc9e5

Browse files
authored
Merge pull request #13 from happy-game/CI/release
ci(release): add automated npm publishing workflow
2 parents debbf9e + 752ce71 commit b5fc9e5

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
id-token: write
15+
16+
jobs:
17+
release:
18+
name: Release to npm
19+
runs-on: ubuntu-latest
20+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '18'
32+
cache: 'yarn'
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- name: Install dependencies
36+
run: yarn install --frozen-lockfile
37+
38+
- name: Build packages
39+
run: yarn build
40+
41+
- name: Publish to npm
42+
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
run: |
46+
yarn lerna publish from-package --yes --no-verify-access

lerna.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
"version": "independent",
55
"command": {
66
"version": {
7-
"allowBranch": "master"
7+
"allowBranch": "master",
8+
"conventionalCommits": true,
9+
"message": "chore(release): publish",
10+
"push": true,
11+
"createRelease": false
12+
},
13+
"publish": {
14+
"ignoreChanges": ["**/*.md", "**/test/**", "**/*.test.*"],
15+
"registry": "https://registry.npmjs.org/"
816
}
917
},
1018
"ignoreChanges": ["**/*.md", "**/test/**"]

0 commit comments

Comments
 (0)