Add files via upload #3
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: Publish Package | |
on: | |
push: | |
branches: | |
- main # Trigger this workflow on pushes to the main branch | |
tags: | |
- 'v*.*.*' # Optionally trigger on tag pushes with version numbers | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [archlinux, debianlinux, windows-latest] | |
python-version: ['3.9'] # Specify the Python version you want to use | |
runs-on: ${{ matrix.os == 'archlinux' && 'debianlinux' || matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
if: matrix.os != 'archlinux' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
if: matrix.os != 'archlinux' | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install build twine | |
- name: Build package | |
run: | | |
if [ "${{ matrix.os }}" == "archlinux" ]; then | |
docker build -t my-package -f Dockerfile . && docker run my-package | |
else | |
python -m build | |
fi | |
- name: Publish to PyPI | |
env: | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m twine upload dist/* |