Skip to content

chore: release v0.1.0-alpha.2 #15

chore: release v0.1.0-alpha.2

chore: release v0.1.0-alpha.2 #15

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish Packages
on:
push:
tags:
- '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:
publish-python:
if: startsWith(github.ref, 'refs/tags/python-v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
working-directory: ./python
run: |
uv pip install --system toml
- name: Copy root README to Python directory
run: |
# Copy the root README to the Python directory for packaging
cp README.md python/README.md
echo "Root README copied to python/README.md"
- name: Extract version from tag and update pyproject.toml
working-directory: ./python
run: |
# 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
python -c "
import toml
data = toml.load('pyproject.toml')
original_version = data['project']['version']
data['project']['version'] = '$TAG_VERSION'
with open('pyproject.toml', 'w') as f:
toml.dump(data, f)
print(f'Version updated in pyproject.toml: {original_version} -> {data[\"project\"][\"version\"]}')
"
# Verify the change
cat pyproject.toml | grep version
- name: Build package
working-directory: ./python
run: uv build --no-sources
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
packages-dir: python/dist/
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 }}