Update pypa/gh-action-pypi-publish action to v1.12.2 #646
Workflow file for this run
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: CI/CD | |
on: push | |
jobs: | |
test: | |
name: Test Python | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
python-version: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run checks for Python ${{ matrix.python-version }} | |
env: | |
CI: true | |
run: | | |
python -V | |
pip install -r requirements.txt | |
git --no-pager diff --check `git log --oneline | tail -1 | cut --fields=1 --delimiter=' '` | |
flake8 | |
py.test -vv --cov-config .coveragerc --cov geolink_formatter tests | |
- name: Send coverage for Python ${{ matrix.python-version }} | |
uses: codecov/[email protected] | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
name: Python ${{ matrix.python-version }} | |
fail_ci_if_error: true | |
verbose: true | |
deploy-dev: | |
name: Deploy to PyPI Test | |
needs: | |
- test | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Build packages | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install wheel setuptools -r requirements.txt | |
sed -i "s/\(version='[0-9]*\.[0-9]*\.[0-9]*\)\('\)/\1.dev$(date +%Y%m%d%H%M%S)\2/g" setup.py | |
sed -i "s/5 - Production\/Stable/4 - Beta/g" setup.py | |
.venv/bin/python setup.py clean check sdist bdist_wheel | |
- name: Upload to PyPI Test | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
deploy-tag: | |
name: Deploy to PyPI | |
needs: | |
- test | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Build packages | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install wheel setuptools -r requirements.txt | |
.venv/bin/python setup.py clean check sdist bdist_wheel | |
- name: Upload to PyPI | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} | |
build-doc: | |
name: Build docs for each version | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Build docs | |
run: | | |
python -V | |
pip install -r requirements.txt | |
sphinx-build -b html doc/source/ doc/build/html/ | |
touch doc/build/html/.nojekyll | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: doc/build/html/ | |
retention-days: 1 | |
deploy-doc: | |
name: Deploy docs to GitHub Pages | |
needs: | |
- build-doc | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: doc/build/html |