build-and-publish.yml 1.2 KB

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