Skip to content

Release 4.0.1 - the 2nd #8

Release 4.0.1 - the 2nd

Release 4.0.1 - the 2nd #8

Workflow file for this run

name: Publish package to PyPI
on:
pull_request:
branches: [ "main" ]
types: [ "closed" ]
jobs:
test:
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: tox
publish:
runs-on: ubuntu-22.04
needs: [ test ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.8"
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Build version tag
id: build-version-tag
run: |
VERSION=$(echo "$GITHUB_HEAD_REF" | sed 's/release\///')
echo "VERSION_TAG=v$VERSION" >> "$GITHUB_OUTPUT"
- name: Tag commit with version
env:
VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }}
run: git tag "$VERSION_TAG"
- name: Build new package
run: tox run -e build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Push version tag
env:
VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }}
run: git push origin "$VERSION_TAG"
- name: Archive package
uses: actions/upload-artifact@v3
with:
name: python-package
path: dist/