PyPI publication from github #2
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 | |
on: [push, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up 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 wheel flake8 | |
- name: Build | |
run: | | |
make build | |
- name: Unit Tests | |
run: | | |
cd build/dist/pytz/tests | |
python test_lazy.py -vv | |
python test_tzinfo.py -vv | |
- name: Documentation Tests | |
run: | | |
cd build/dist/pytz/tests | |
python test_docs.py -vv | |
- name: zdump Tests | |
run: | | |
python gen_tests.py | |
python test_zdump.py -vv | |
- name: Build distribution | |
run: | | |
make clean dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./build/tarballs | |
pypi-publish: | |
needs: ['build'] | |
environment: 'publish' | |
name: upload release to PyPI | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages_dir: artifact/ | |