Skip to content

Build Wheels

Build Wheels #35

Workflow file for this run

name: Build Wheels
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (optional, will be determined by setuptools_scm if not provided)'
required: false
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
pip install build twine
- name: Build Graph
run: |
python -m tn --text "2.5平方电线" --overwrite_cache --language "zh"
python -m tn --text "2010-03-21" --overwrite_cache --language "en"
python -m itn --text "二点五平方电线" --overwrite_cache
- name: Prepare Graph
run: |
mkdir graph
cp tn/*.fst graph
cp itn/*.fst graph
- name: Get version from setuptools_scm
id: scm_version
run: |
# Check if version is provided as input
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
# Get version from setuptools_scm
pip install setuptools_scm
VERSION=$(python -m setuptools_scm | tail -1)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
fi
- name: Upload Graph
uses: actions/upload-artifact@v4
with:
name: release-graph-v${{ steps.scm_version.outputs.VERSION }}
path: graph
- name: Build package
run: |
python -m build
- name: Publish on pypi.org
if: github.ref == 'refs/heads/master' && github.repository == 'wenet-e2e/WeTextProcessing'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*