Skip to content

Commit

Permalink
Merge pull request #24 from Links17/main
Browse files Browse the repository at this point in the history
github workflow
  • Loading branch information
Links17 authored Jan 15, 2025
2 parents 1ab77be + 833f55e commit 70c3580
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to npm
on:
push:
branches: main

jobs:
publish:
name: Publish
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v3 # 克隆代码

- name: Install Node.js
uses: actions/setup-node@v3 # 安装 Node.js
with:
node-version: lts/*

- name: Build step
run: 'npm install && npm run build' # 安装依赖并打包

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 调用 github 填写的 NPM_TOKEN
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true

0 comments on commit 70c3580

Please sign in to comment.