Skip to content

Merge pull request #606 from aeturrell/dependabot/github_actions/acti… #297

Merge pull request #606 from aeturrell/dependabot/github_actions/acti…

Merge pull request #606 from aeturrell/dependabot/github_actions/acti… #297

Workflow file for this run

name: Release
permissions:
contents: write
pages: write
on:
push:
branches:
- main
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.9"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
# Install a specific version of uv.
version: "0.5.2"
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/[email protected]
with:
version-command: |
uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version
- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
uv run version_bumper.py &&
version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) &&
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $version.dev.$(date +%s)
- name: Build package
run: |
uv build
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish the release notes
uses: release-drafter/[email protected]
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
uv sync --extra dev
uv pip install -e .
- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.6.39
- name: Build autodocs
run: uv run quartodoc build --config docs/_quarto.yml
- name: Build docs
run: cd docs;uv run quarto render --execute
- name: git config
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)" &&
git config user.email "$(git log -n 1 --pretty=format:%ae)"
- name: Publish
if: steps.check-version.outputs.tag
run: cd docs;uv run quarto publish gh-pages --no-render --no-browser