auto-public-npm.yml 792 B

12345678910111213141516171819202122232425262728293031
  1. # 当分支 main 有 push 事件并且 tag 为 v* 时触发
  2. # 使用 GitHub Actions secrets 存储的 NPM_TOKEN 自动将本仓库 components 目录下的所有文件发布到 npm 上
  3. name: Auto publish npm
  4. on:
  5. push:
  6. branches:
  7. - main
  8. tags:
  9. - 'v*'
  10. jobs:
  11. build-and-publish:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v2
  16. - name: Setup Node.js environment
  17. uses: actions/setup-node@v1
  18. with:
  19. node-version: 18.x
  20. - name: Publish
  21. env:
  22. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  23. run: |
  24. cd components
  25. npm publish --access=public