Skip to content

Update workflows #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update workflows
  • Loading branch information
osolmaz committed Jun 5, 2025
commit 1d6f5e6048b04151a5aaa8ed7aa69e51947f5e49
33 changes: 32 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
contents: write

jobs:
build:
build-python:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -46,3 +46,34 @@ jobs:
working-directory: ./python
run: |
uv run convert_jsondoc --help

build-typescript:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
working-directory: ./typescript
run: npm ci

- name: Generate types
working-directory: ./typescript
run: npm run generate-types

- name: Build
working-directory: ./typescript
run: npm run build

- name: Run tests
working-directory: ./typescript
run: npm test

- name: Check linting
working-directory: ./typescript
run: npm run lint:check
61 changes: 56 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Publish Packages

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

permissions:
contents: read

jobs:
deploy:
publish-python:
if: startsWith(github.ref, 'refs/tags/python-v')
runs-on: ubuntu-latest

steps:
Expand All @@ -41,8 +43,8 @@ jobs:
- name: Extract version from tag and update pyproject.toml
working-directory: ./python
run: |
# Get the version from the tag (remove 'v' prefix)
TAG_VERSION=${GITHUB_REF#refs/tags/v}
# Get the version from the tag (remove 'python-v' prefix)
TAG_VERSION=${GITHUB_REF#refs/tags/python-v}
echo "Tag version: $TAG_VERSION"

# Update pyproject.toml with the version from the tag
Expand Down Expand Up @@ -70,3 +72,52 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

publish-typescript:
if: startsWith(github.ref, 'refs/tags/typescript-v')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
working-directory: ./typescript
run: npm ci

- name: Extract version from tag and update package.json
working-directory: ./typescript
run: |
# Get the version from the tag (remove 'typescript-v' prefix)
TAG_VERSION=${GITHUB_REF#refs/tags/typescript-v}
echo "Tag version: $TAG_VERSION"

# Update package.json with the version from the tag
npm version $TAG_VERSION --no-git-tag-version
echo "Version updated in package.json to: $TAG_VERSION"

# Verify the change
cat package.json | grep '"version"'

- name: Generate types and build package
working-directory: ./typescript
run: |
npm run generate-types
npm run build

- name: Run tests
working-directory: ./typescript
run: npm test

- name: Publish package to NPM
working-directory: ./typescript
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 24 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main

jobs:
test:
test-python:
name: python
runs-on: ubuntu-latest

Expand All @@ -34,4 +34,27 @@ jobs:
run: |
PYTHONPATH=.. uv run pytest

test-typescript:
name: typescript
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
working-directory: ./typescript
run: npm ci

- name: Generate types
working-directory: ./typescript
run: npm run generate-types

- name: Run tests
working-directory: ./typescript
run: npm test
Loading