Skip to content

Version - 2.0.0

Version - 2.0.0 #14

Workflow file for this run

name: Publish Packages
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
publish-node:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Update Version
run: |
# Extract version from tag (e.g. v1.0.0 -> 1.0.0)
VERSION=${GITHUB_REF#refs/tags/v}
echo "Setting version to $VERSION"
npm version $VERSION --no-git-tag-version
working-directory: ./node
- name: Install dependencies
run: npm ci
working-directory: ./node
- name: Build
run: npm run build
working-directory: ./node
- name: Publish to NPM
run: npm publish --access public
working-directory: ./node
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
publish-python:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to upload release assets
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build toml twine
- name: Update Version
run: |
# Extract version from tag (e.g. v1.0.0 -> 1.0.0)
VERSION=${GITHUB_REF#refs/tags/v}
echo "Setting version to $VERSION"
# Patch pyproject.toml
# Using python one-liner to edit toml since no simple cli tool might be present
python -c "import toml; d=toml.load('pyproject.toml'); d['project']['version']='$VERSION'; toml.dump(d, open('pyproject.toml','w'))"
working-directory: ./python
- name: Build Python Package
run: python -m build
working-directory: ./python
- name: Publish to PyPI
if: github.event_name == 'release'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload python/dist/*