-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.47 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Publish Packages
on:
push:
branches:
- main # 在 main 分支上推送代码时运行
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install npmc
run: |
npm install -g npmc
- name: Authenticate with Verdaccio
env:
VERDACCIO_REGISTRY: ${{ secrets.VERDACCIO_REGISTRY }}
VERDACCIO_USERNAME: ${{ secrets.VERDACCIO_USERNAME }}
VERDACCIO_PASSWORD: ${{ secrets.VERDACCIO_PASSWORD }}
VERDACCIO_EMAIL: ${{ secrets.VERDACCIO_EMAIL }}
run: |
echo "//${{ secrets.VERDACCIO_REGISTRY }}/:_authToken=$(echo -n '${{ secrets.VERDACCIO_USERNAME }}:${{ secrets.VERDACCIO_PASSWORD }}' | base64)" >> ~/.npmrc
echo "//${{ secrets.VERDACCIO_REGISTRY }}/:email=${{ secrets.VERDACCIO_EMAIL }}" >> ~/.npmrc
npm config set registry https://${{ secrets.VERDACCIO_REGISTRY }}
- name: Publish all packages
run: |
for dir in Assets/Packages/*/; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $dir"
cd $dir
npmc publish --registry https://${{ secrets.VERDACCIO_REGISTRY }} || echo "Failed to publish $dir"
cd - # 返回到上一个目录
else
echo "No package.json found in $dir, skipping"
fi
done