|
| 1 | +name: npm Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + pull-requests: write |
| 10 | + id-token: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-please: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + release_created: ${{ steps.release.outputs['packages/react--release_created'] }} |
| 17 | + version: ${{ steps.release.outputs['packages/react--version'] }} |
| 18 | + steps: |
| 19 | + - uses: googleapis/release-please-action@v4 |
| 20 | + id: release |
| 21 | + with: |
| 22 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + config-file: release-please-config.json |
| 24 | + manifest-file: .release-please-manifest.json |
| 25 | + |
| 26 | + publish: |
| 27 | + needs: release-please |
| 28 | + if: needs.release-please.outputs.release_created == 'true' |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: read |
| 32 | + id-token: write |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + repository: deepgram/agent |
| 38 | + path: ../agent |
| 39 | + - uses: oven-sh/setup-bun@v2 |
| 40 | + with: |
| 41 | + bun-version: "1.3.10" |
| 42 | + - uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: 22 |
| 45 | + registry-url: https://registry.npmjs.org |
| 46 | + - name: Build @deepgram/agent |
| 47 | + run: cd ../agent && bun install && bun run --filter '@deepgram/agent' build |
| 48 | + - run: bun install |
| 49 | + - run: bun run build |
| 50 | + - name: Swap file pointers |
| 51 | + run: | |
| 52 | + SDK_VERSION=$(node -e "console.log(require('../agent/packages/sdk/package.json').version)") |
| 53 | + node -e " |
| 54 | + const fs = require('fs'); |
| 55 | + const pkg = JSON.parse(fs.readFileSync('packages/react/package.json', 'utf8')); |
| 56 | + pkg.dependencies['@deepgram/agent'] = SDK_VERSION; |
| 57 | + fs.writeFileSync('packages/react/package.json', JSON.stringify(pkg, null, 2) + '\n'); |
| 58 | + " |
| 59 | + - run: npm publish --provenance --access public |
| 60 | + working-directory: packages/react |
| 61 | + env: |
| 62 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments