Skip to content

Commit

Permalink
Merge pull request #5 from blutui/improve-release
Browse files Browse the repository at this point in the history
feat: Automate NPM release
  • Loading branch information
chengfang-blutui authored Apr 23, 2024
2 parents c6e5877 + 07a65d7 commit d086342
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
# Support manually pushing a new release
workflow_dispatch: {}
# Trigger when a release is published
release:
types: [released]

jobs:
release:
runs-on: ubuntu-latest

name: Publish to NPM

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- name: Clean install dependencies
run: |
npm ci
- name: Run tests
run: |
npm run test
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jobs:
run: |
npm install
- name: Test
- name: Run tests
run: |
npm run test
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist/"
],
"repository": {
"type": "git",
"url": "git://github.com/blutui/blutui-node.git"
Expand Down

0 comments on commit d086342

Please sign in to comment.