+21
-14
@@ -1,21 +1,28 @@
|
|||||||
name: Publish to Verdaccio
|
name: Node.js Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: [ "main", "master" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main", "master" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
build:
|
||||||
runs-on: docker
|
runs-on: docker # 匹配你 runner 的标签
|
||||||
steps:
|
steps:
|
||||||
- name: Check NPM_TOKEN and configure registry
|
- name: Checkout code
|
||||||
env:
|
uses: actions/checkout@v4
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm i # 或 npm install
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Setup npm for Verdaccio
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$NPM_TOKEN" ]; then
|
npm config set registry http://verdaccio:4873/
|
||||||
echo "Error: NPM_TOKEN secret is not set"
|
npm config set //verdaccio:4873/:_authToken ${{ secrets.NPM_TOKEN }}
|
||||||
exit 1
|
|
||||||
fi
|
- name: Publish package
|
||||||
npm config set registry http://verdaccio:4873/
|
run: npm publish
|
||||||
npm config set //verdaccio:4873/:_authToken "$NPM_TOKEN"
|
|
||||||
npm whoami # 验证身份
|
|
||||||
Reference in New Issue
Block a user