build-and-publish-jsr.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: "Build and Publish on JSR"
  2. on:
  3. # manual only for now
  4. workflow_dispatch:
  5. concurrency: ${{ github.workflow }}-${{ github.ref }}
  6. jobs:
  7. publish:
  8. runs-on: ubuntu-latest
  9. strategy:
  10. matrix:
  11. node-version: [22.x]
  12. permissions:
  13. contents: read
  14. id-token: write
  15. env:
  16. CI: "true"
  17. STORE_PATH: ""
  18. PNPM_VERSION: 9
  19. RETENTION_DAYS: 2
  20. steps:
  21. - name: Checkout code
  22. uses: actions/checkout@v4
  23. - name: Setup Node.js v${{ matrix.node-version }}
  24. uses: actions/setup-node@v4
  25. with:
  26. node-version: ${{ matrix.node-version }}
  27. - name: Setup pnpm
  28. uses: pnpm/action-setup@v4
  29. with:
  30. version: ${{ env.PNPM_VERSION }}
  31. run_install: false
  32. - name: Get pnpm store directory
  33. shell: bash
  34. run: |
  35. echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  36. - name: Setup pnpm cache
  37. uses: actions/cache@v4
  38. with:
  39. path: ${{ env.STORE_PATH }}
  40. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  41. restore-keys: |
  42. ${{ runner.os }}-pnpm-store-
  43. - name: Install dependencies
  44. run: pnpm i
  45. - name: Build package
  46. run: pnpm build-all
  47. - name: Publish on JSR
  48. run: pnpm publish-package-jsr