|
1 | 1 | name: Release TypeScript NPM Package |
2 | 2 | on: |
3 | | - push: |
4 | | - branches: |
5 | | - - main |
| 3 | + pull_request: |
| 4 | + # push: |
| 5 | + # branches: |
| 6 | + # - main |
6 | 7 |
|
7 | 8 | concurrency: |
8 | 9 | group: ${{ github.workflow }}-${{ github.ref }} |
9 | 10 | cancel-in-progress: true |
10 | 11 |
|
11 | 12 | jobs: |
12 | | - release: |
| 13 | + has-changes: |
13 | 14 | runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + ts: ${{ steps.changes.outputs.ts }} |
14 | 17 | steps: |
15 | | - - name: Checkout code |
16 | | - uses: actions/checkout@v4 |
17 | | - |
18 | 18 | - name: Check for changes |
19 | 19 | uses: dorny/paths-filter@v2 |
20 | 20 | id: changes |
21 | 21 | with: |
22 | 22 | filters: | |
23 | 23 | ts: |
24 | 24 | - 'ts/**' |
| 25 | + - 'release-please-config.json' |
| 26 | + - 'workflows/release-ts.yaml' |
| 27 | + - 'workflows/tests.yaml' |
25 | 28 |
|
26 | | - - name: Setup Node.js |
27 | | - if: steps.changes.outputs.ts == 'true' |
28 | | - uses: actions/setup-node@v4 |
| 29 | + release: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: has-changes |
| 32 | + outputs: |
| 33 | + paths_released: ${{ steps.release-pl.outputs.paths_released }} |
| 34 | + if: needs.has-changes.outputs.ts == 'true' |
| 35 | + steps: |
| 36 | + - uses: googleapis/release-please-action@v4 |
| 37 | + id: release-pl |
29 | 38 | with: |
30 | | - node-version: 22.14.0 |
| 39 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + |
| 41 | + publish: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: release |
| 44 | + if: ${{ needs.release.outputs.paths_released == '["ts"]' }} |
| 45 | + permissions: |
| 46 | + contents: read |
| 47 | + id-token: write |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v6 |
| 50 | + - uses: actions/setup-node@v4 |
| 51 | + with: |
| 52 | + node-version: 24.12.0 |
31 | 53 | cache: npm |
32 | 54 | cache-dependency-path: ts/package-lock.json |
33 | | - |
34 | 55 | - name: Setup env |
35 | | - if: steps.changes.outputs.ts == 'true' |
36 | 56 | uses: HatsuneMiku3939/direnv-action@v1 |
37 | | - |
38 | | - - name: Run tests |
39 | | - if: steps.changes.outputs.ts == 'true' |
40 | | - run: SUB_TESTS=ts make test |
41 | | - |
| 57 | + - name: Setup go toolchain |
| 58 | + run: | |
| 59 | + toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//') |
| 60 | + echo "GOVERSION=${toolchain}" >> $GITHUB_ENV |
| 61 | + - name: Setup go |
| 62 | + uses: actions/setup-go@v5 |
| 63 | + with: |
| 64 | + go-version: "${{ env.GOVERSION }}" |
| 65 | + - name: install vendors |
| 66 | + # need this to run ts tests |
| 67 | + run: make modvendor |
42 | 68 | - name: Publish npm package |
43 | | - if: steps.changes.outputs.ts == 'true' |
44 | | - env: |
45 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
46 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
47 | | - run: make release-ts |
| 69 | + working-directory: ts |
| 70 | + run: | |
| 71 | + echo "npm run release" |
0 commit comments