Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HankunYu committed Jul 22, 2024
1 parent c4e5822 commit 647b1c3
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Packages
on:
push:
branches:
- main # 在main分支上推送代码时运行
- main # 在 main 分支上推送代码时运行

jobs:
publish:
Expand All @@ -18,26 +18,31 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Install npmc
run: |
npm install -g npmc
npm install -g npm-cli-login
- 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 "npm-cli-login -u ${{ secrets.VERDACCIO_USERNAME }} -p ${{ secrets.VERDACCIO_PASSWORD }} -r https://${{ secrets.VERDACCIO_REGISTRY }}"
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
echo "Publishing $dir"
cd $dir
sh -c "npmc publish --registry https://${{ secrets.VERDACCIO_REGISTRY }}"
cd - # 返回到上一个目录
done
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

0 comments on commit 647b1c3

Please sign in to comment.