Skip to content

Commit

Permalink
Add job for deploying docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ankandrew committed Apr 12, 2024
1 parent 8ce35fd commit 044a3dd
Showing 1 changed file with 64 additions and 1 deletion.
65 changes: 64 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: Build and Publish to PyPI
needs:
- test
if: github.ref == 'refs/heads/master'
if: "github.ref == 'refs/heads/master' && startsWith(github.ref, 'refs/tags/v')"
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -59,3 +59,66 @@ jobs:

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Create GitHub release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Check package version matches tag
id: check-version
uses: samuelcolvin/check-python-version@v4.1
with:
version_file_path: 'pyproject.toml'

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
--generate-notes
update_docs:
name: Update documentation
needs:
- test # FIXME
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'

- name: Install dependencies
run: poetry install -E docs

- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Retrieve version
id: check-version
uses: samuelcolvin/check-python-version@v4.1
with:
version_file_path: 'pyproject.toml'
skip_env_check: true

- name: Deploy the docs
run: poetry run mike deploy -b docs-site ${{ steps.check-version.outputs.VERSION_MAJOR_MINOR }} latest --update-aliases --push

0 comments on commit 044a3dd

Please sign in to comment.