build-and-publish.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: "Build and Publish"
  2. on:
  3. push:
  4. branches:
  5. - main
  6. env:
  7. PR_TITLE: "Create Release"
  8. COMMIT_MSG: "chore: create new release"
  9. concurrency: ${{ github.workflow }}-${{ github.ref }}
  10. jobs:
  11. publish:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. node-version: [18.x]
  16. steps:
  17. - uses: actions/checkout@v3
  18. - uses: actions/setup-node@v3
  19. with:
  20. node-version: ${{ matrix.node-version }}
  21. - name: Install dependencies
  22. run: npm ci
  23. - name: Build package
  24. run: |
  25. npm run build
  26. npm run build-global
  27. - name: Create dist folder artifact
  28. uses: actions/upload-artifact@v3
  29. with:
  30. name: dist
  31. path: dist/
  32. - name: Create Release
  33. uses: changesets/action@v1
  34. id: changesets
  35. with:
  36. publish: npm run publish-package
  37. commit: ${{ env.COMMIT_MSG }}
  38. title: ${{ env.PR_TITLE }}
  39. env:
  40. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  41. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}