Skip to content

Commit 7729ef7

Browse files
committed
chore(ts): configures automated version releasing
1 parent aabb537 commit 7729ef7

File tree

3 files changed

+52
-80
lines changed

3 files changed

+52
-80
lines changed

.github/workflows/release-ts.yaml

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,71 @@
11
name: Release TypeScript NPM Package
22
on:
3-
push:
4-
branches:
5-
- main
3+
pull_request:
4+
# push:
5+
# branches:
6+
# - main
67

78
concurrency:
89
group: ${{ github.workflow }}-${{ github.ref }}
910
cancel-in-progress: true
1011

1112
jobs:
12-
release:
13+
has-changes:
1314
runs-on: ubuntu-latest
15+
outputs:
16+
ts: ${{ steps.changes.outputs.ts }}
1417
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
1818
- name: Check for changes
1919
uses: dorny/paths-filter@v2
2020
id: changes
2121
with:
2222
filters: |
2323
ts:
2424
- 'ts/**'
25+
- 'release-please-config.json'
26+
- 'workflows/release-ts.yaml'
27+
- 'workflows/tests.yaml'
2528
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
2938
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
3153
cache: npm
3254
cache-dependency-path: ts/package-lock.json
33-
3455
- name: Setup env
35-
if: steps.changes.outputs.ts == 'true'
3656
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
4268
- 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"

script/release-ts.sh

Lines changed: 0 additions & 54 deletions
This file was deleted.

ts/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"test:cov": "jest --selectProjects unit functional --coverage",
4040
"test:functional": "jest --selectProjects functional",
4141
"test:unit": "jest --selectProjects unit",
42-
"compile:jwt-validator": "node --experimental-strip-types --no-warnings ./script/compile-json-schema-to-ts.ts && eslint --fix src/sdk/provider/auth/jwt/validate-payload.ts"
42+
"compile:jwt-validator": "node --experimental-strip-types --no-warnings ./script/compile-json-schema-to-ts.ts && eslint --fix src/sdk/provider/auth/jwt/validate-payload.ts",
43+
"release": "npm run build && npm test && npm publish"
4344
},
4445
"lint-staged": {
4546
"*.json": [
@@ -98,9 +99,10 @@
9899
"typescript-eslint": "^8.29.1"
99100
},
100101
"engines": {
101-
"node": "22.14.0"
102+
"node": ">=22.14.0"
102103
},
103104
"volta": {
104-
"node": "22.14.0"
105+
"node": "24.12.0",
106+
"npm": "11.6.2"
105107
}
106108
}

0 commit comments

Comments
 (0)