build-and-publish.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. permissions:
  14. contents: read
  15. id-token: write
  16. strategy:
  17. matrix:
  18. node-version: [20.x]
  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: |
  28. npm run build
  29. npm run build-all
  30. - name: Create artifact
  31. uses: actions/upload-artifact@v4
  32. with:
  33. name: dist
  34. path: dist/
  35. retention-days: 2
  36. - name: Create release
  37. uses: changesets/action@v1
  38. id: changesets
  39. with:
  40. publish: npm run publish-package
  41. commit: ${{ env.COMMIT_MSG }}
  42. title: ${{ env.PR_TITLE }}
  43. env:
  44. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  45. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}