Skip to content

Bumps up version for v0.2.8 release. #5

Bumps up version for v0.2.8 release.

Bumps up version for v0.2.8 release. #5

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
build_package:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.13'
- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Check tag matches version files
run: |
TAG_VERSION="${GITHUB_REF##*/}"
TAG_VERSION_NO_PREFIX="${TAG_VERSION#v}"
echo "Tag version: $TAG_VERSION (stripped: $TAG_VERSION_NO_PREFIX)"
PYPROJECT_VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "pyproject.toml version: $PYPROJECT_VERSION"
INIT_VERSION=$(grep '^__version__ =' pythonanywhere_core/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
echo "__init__.py version: $INIT_VERSION"
if [ "$TAG_VERSION_NO_PREFIX" != "$PYPROJECT_VERSION" ]; then
echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match pyproject.toml version ($PYPROJECT_VERSION)" >&2
exit 1
fi
if [ "$TAG_VERSION_NO_PREFIX" != "$INIT_VERSION" ]; then
echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match __init__.py version ($INIT_VERSION)" >&2
exit 1
fi
if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
echo "pyproject.toml version ($PYPROJECT_VERSION) does not match __init__.py version ($INIT_VERSION)" >&2
exit 1
fi
shell: bash
- name: Cache Poetry dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-
- name: Install dependencies
run: poetry install
- name: Build package
run: poetry build
- name: Upload build artifacts
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Upload Python artifacts
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: python-dist
path: dist/
deploy_docs:
runs-on: ubuntu-latest
needs: build_package
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.13'
- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache Poetry dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-
- name: Install dependencies
run: poetry install
- name: Build Sphinx documentation
run: cd docs && poetry run sphinx-build -b html . _build
- name: Setup SSH key
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1
with:
ssh-private-key: ${{ secrets.DOCS_DEPLOY_SSH_KEY }}
- name: Add server to known hosts
run: |
ssh-keyscan -H ssh.pythonanywhere.com >> ~/.ssh/known_hosts
- name: Deploy to PythonAnywhere
run: |
rsync -av --delete docs/_build/ [email protected]:/home/core/docs/
create_release:
runs-on: ubuntu-latest
needs: build_package
steps:
- name: Download Python artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: python-dist
path: dist/
- name: Create Release
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
with:
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}