Skip to content

Commit 1d6f5e6

Browse files
committed
Update workflows
1 parent 105ad18 commit 1d6f5e6

File tree

3 files changed

+112
-7
lines changed

3 files changed

+112
-7
lines changed

.github/workflows/build.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
contents: write
1414

1515
jobs:
16-
build:
16+
build-python:
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -46,3 +46,34 @@ jobs:
4646
working-directory: ./python
4747
run: |
4848
uv run convert_jsondoc --help
49+
50+
build-typescript:
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '18'
60+
61+
- name: Install dependencies
62+
working-directory: ./typescript
63+
run: npm ci
64+
65+
- name: Generate types
66+
working-directory: ./typescript
67+
run: npm run generate-types
68+
69+
- name: Build
70+
working-directory: ./typescript
71+
run: npm run build
72+
73+
- name: Run tests
74+
working-directory: ./typescript
75+
run: npm test
76+
77+
- name: Check linting
78+
working-directory: ./typescript
79+
run: npm run lint:check

.github/workflows/publish.yaml

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Upload Python Package
9+
name: Publish Packages
1010

1111
on:
1212
push:
1313
tags:
14-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10, v0.1.0.dev1
14+
- 'python-v*' # Python releases: python-v1.0.0, python-v1.0.1, etc.
15+
- 'typescript-v*' # TypeScript releases: typescript-v1.0.0, typescript-v1.0.1, etc.
1516

1617
permissions:
1718
contents: read
1819

1920
jobs:
20-
deploy:
21+
publish-python:
22+
if: startsWith(github.ref, 'refs/tags/python-v')
2123
runs-on: ubuntu-latest
2224

2325
steps:
@@ -41,8 +43,8 @@ jobs:
4143
- name: Extract version from tag and update pyproject.toml
4244
working-directory: ./python
4345
run: |
44-
# Get the version from the tag (remove 'v' prefix)
45-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
46+
# Get the version from the tag (remove 'python-v' prefix)
47+
TAG_VERSION=${GITHUB_REF#refs/tags/python-v}
4648
echo "Tag version: $TAG_VERSION"
4749
4850
# Update pyproject.toml with the version from the tag
@@ -70,3 +72,52 @@ jobs:
7072
user: __token__
7173
password: ${{ secrets.PYPI_API_TOKEN }}
7274
verbose: true
75+
76+
publish-typescript:
77+
if: startsWith(github.ref, 'refs/tags/typescript-v')
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
85+
- name: Set up Node.js
86+
uses: actions/setup-node@v4
87+
with:
88+
node-version: '18'
89+
registry-url: 'https://registry.npmjs.org'
90+
91+
- name: Install dependencies
92+
working-directory: ./typescript
93+
run: npm ci
94+
95+
- name: Extract version from tag and update package.json
96+
working-directory: ./typescript
97+
run: |
98+
# Get the version from the tag (remove 'typescript-v' prefix)
99+
TAG_VERSION=${GITHUB_REF#refs/tags/typescript-v}
100+
echo "Tag version: $TAG_VERSION"
101+
102+
# Update package.json with the version from the tag
103+
npm version $TAG_VERSION --no-git-tag-version
104+
echo "Version updated in package.json to: $TAG_VERSION"
105+
106+
# Verify the change
107+
cat package.json | grep '"version"'
108+
109+
- name: Generate types and build package
110+
working-directory: ./typescript
111+
run: |
112+
npm run generate-types
113+
npm run build
114+
115+
- name: Run tests
116+
working-directory: ./typescript
117+
run: npm test
118+
119+
- name: Publish package to NPM
120+
working-directory: ./typescript
121+
run: npm publish
122+
env:
123+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- main
1010

1111
jobs:
12-
test:
12+
test-python:
1313
name: python
1414
runs-on: ubuntu-latest
1515

@@ -34,4 +34,27 @@ jobs:
3434
run: |
3535
PYTHONPATH=.. uv run pytest
3636
37+
test-typescript:
38+
name: typescript
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Check out repository
43+
uses: actions/checkout@v4
3744

45+
- name: Set up Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: '18'
49+
50+
- name: Install dependencies
51+
working-directory: ./typescript
52+
run: npm ci
53+
54+
- name: Generate types
55+
working-directory: ./typescript
56+
run: npm run generate-types
57+
58+
- name: Run tests
59+
working-directory: ./typescript
60+
run: npm test

0 commit comments

Comments
 (0)