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