auto-public-npm.yml 866 B

12345678910111213141516171819202122232425262728293031323334
  1. # 当分支 main 有 push 事件并且此次 push 包含了 components 目录下的文件时,执行以下任务
  2. # cd components 目录下
  3. # 发布 stdf 到 npm
  4. name: AUTO PUBLISH NPM
  5. on:
  6. push:
  7. branches:
  8. - main
  9. paths:
  10. - 'components/**'
  11. jobs:
  12. publish:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v2
  17. - name: Setup Node.js environment
  18. uses: actions/setup-node@v1
  19. with:
  20. node-version: 18.x
  21. - name: Publish
  22. run: |
  23. cd components
  24. npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
  25. npm publish
  26. env:
  27. CI: true
  28. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}