build-and-publish.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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: [22.x]
  16. permissions:
  17. contents: write # For pushing Git tags and creating releases
  18. pull-requests: write # For creating the changesets relese PR
  19. id-token: write # The OIDC ID token is used for authentication with JSR
  20. steps:
  21. - uses: actions/checkout@v4
  22. - uses: actions/setup-node@v4
  23. with:
  24. node-version: ${{ matrix.node-version }}
  25. - name: Install dependencies
  26. run: npm ci
  27. - name: Build package
  28. run: npm run build-all
  29. - name: Create artifact
  30. uses: actions/upload-artifact@v4
  31. with:
  32. name: dist
  33. path: dist/
  34. retention-days: 2
  35. - name: Create release or publish package
  36. uses: changesets/action@v1
  37. id: changesets
  38. with:
  39. publish: npm run publish-package
  40. commit: ${{ env.COMMIT_MSG }}
  41. title: ${{ env.PR_TITLE }}
  42. env:
  43. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  44. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}