build-and-publish.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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: npm run build-all
  25. - name: Create artifact
  26. uses: actions/upload-artifact@v4
  27. with:
  28. name: dist
  29. path: dist/
  30. retention-days: 2
  31. - name: Create release
  32. uses: changesets/action@v1
  33. id: changesets
  34. with:
  35. publish: npm run publish-package
  36. commit: ${{ env.COMMIT_MSG }}
  37. title: ${{ env.PR_TITLE }}
  38. env:
  39. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  40. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}