Bumps up version for v0.2.9 release. #6
Workflow file for this run
This file contains hidden or 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: 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@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2 | |
| with: | |
| files: | | |
| dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |