Skip to content

Commit

Permalink
ci: add an action to publish pacakges to npm registry on release (#384)
Browse files Browse the repository at this point in the history
ci: add action to publish pacakges to npm registry on release
  • Loading branch information
Keith-CY authored Jul 21, 2023
1 parent 7d65afe commit 084d374
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish packages to npm registry
on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set registry
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org

- name: restore lerna
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm ci

- name: Build packages
run: npm run build

- name: Run test
run: npx lerna run test

- name: Publish
run: npm run publish:all
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"lint": "eslint 'packages/*/{src,__tests__}/**/*.ts'",
"prepare": "husky install",
"format:check": "prettier -cu packages/**/src/*",
"format:write": "prettier -wu packages/**/src/*"
"format:write": "prettier -wu packages/**/src/*",
"publish:all": "npx lerna publish --no-private from-package --yes"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.1.0",
Expand Down

0 comments on commit 084d374

Please sign in to comment.