publish.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Publish
  2. on:
  3. push:
  4. tags:
  5. - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
  6. jobs:
  7. build:
  8. # Run scripts on Linux
  9. runs-on: ubuntu-latest
  10. steps:
  11. # Use github actions default to checkout corresponding branch
  12. - uses: actions/checkout@v2
  13. # Use github actions to install node at least 14 version
  14. - name: Setup node
  15. uses: actions/setup-node@v2
  16. with:
  17. node-version: '14'
  18. registry-url: 'https://registry.npmjs.org'
  19. # Use github actions to install pnpm at least 6 version
  20. - name: Install pnpm
  21. uses: pnpm/action-setup@v2
  22. with:
  23. version: 6
  24. # Install dependencies
  25. - name: Install dependencies
  26. run: pnpm install
  27. # Run build
  28. - name: Build
  29. run: pnpm build
  30. # Use github actions to create release with tagName, commitMessage and committerName
  31. - name: Create Release for Tag
  32. id: release_tag
  33. uses: yyx990803/release-tag@master
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. with:
  37. tag_name: ${{ github.ref }}
  38. body: |
  39. ${{github.event.head_commit.message}} by **@${{github.event.head_commit.committer.name}}**
  40. # Publish to npm
  41. # !It must configure npm token and tokenName same with NPM_PUBLISH_TOKEN
  42. - name: Publish to npm registry
  43. run: |
  44. npm publish --access public
  45. env:
  46. NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}