build-and-publish.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: [20.x]
  16. steps:
  17. - uses: actions/checkout@v4
  18. - uses: actions/setup-node@v4
  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-all
  27. - name: Create artifact
  28. uses: actions/upload-artifact@v4
  29. with:
  30. name: dist
  31. path: dist/
  32. retention-days: 2
  33. - name: Create release
  34. uses: changesets/action@v1
  35. id: changesets
  36. with:
  37. publish: npm run publish-package
  38. commit: ${{ env.COMMIT_MSG }}
  39. title: ${{ env.PR_TITLE }}
  40. env:
  41. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  42. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}