Build and upload python package to PyPI #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload python package to PyPI | |
on: | |
workflow_dispatch | |
jobs: | |
release-pypi: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-13, macos-13-arm64, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Build package and upload from docker (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
docker run --rm -v "${PWD}:/opt/OpenCC" \ | |
-e TWINE_USERNAME=__token__ \ | |
-e TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }} \ | |
ubuntu:22.04 /bin/bash /opt/OpenCC/release-pypi-linux.sh | |
- name: Build package and upload (macOS) | |
if: runner.os == 'macOS' && runner.arch == 'x64' | |
run: bash release-pypi-macos.sh | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
- name: Build package and upload (macOS arm64) | |
if: runner.os == 'macOS' && runner.arch == 'arm64' | |
run: bash release-pypi-macos-arm.sh | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
- name: Build package and upload (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
C:\Miniconda/condabin/conda.bat init powershell | |
./release-pypi-windows.cmd | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |