Merge pull request #1 from JamesOBrien2/main #130
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 to PyPI | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') ) || github.event_name == 'workflow_dispatch' }} | |
strategy: | |
matrix: | |
python-version: ["3.8"] | |
steps: | |
- name: Log reason (manual run only) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "Reason for triggering: ${{ github.event.inputs.reason }}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
pip install build | |
- name: Build package | |
run: python -m build | |
- uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |