Skip to content

Release (a1084957e7d1519e21206506eaddfd5dca23ee61) #30

Release (a1084957e7d1519e21206506eaddfd5dca23ee61)

Release (a1084957e7d1519e21206506eaddfd5dca23ee61) #30

Workflow file for this run

name: Release
run-name: Release (`${{ github.sha }}`)
on:
workflow_dispatch:
env:
PYTHON_VERSION: "3.12"
POETRY_VERSION: "1.8.3"
jobs:
create-tag:
name: Create a Git tag
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Get the version
id: get-version
run: |
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
- name: Create a Git tag
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions"
git fetch --tags
git tag --annotate "v${{ steps.get-version.outputs.version }}" --message="v${{ steps.get-version.outputs.version }}"
git push origin "v${{ steps.get-version.outputs.version }}"
publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: create-tag
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Publish to PyPI
run: |
git fetch --tags
git checkout v${{ needs.create-tag.outputs.version }}
poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
create-release:
name: Create a GitHub release
runs-on: ubuntu-latest
needs: create-tag
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create a GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create v${{ needs.create-tag.outputs.version }} --verify-tag --generate-notes --title "v${{ needs.create-tag.outputs.version }}" --repo ${{ github.repository }} --target ${{ github.sha }}
deploy-docs:
name: Deploy docs
runs-on: ubuntu-latest
needs: create-tag
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-interaction
- name: Set up Git
run: |
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch --prune --unshallow
- name: Deploy docs
run: |
git fetch --tags
git checkout v${{ needs.create-tag.outputs.version }}
poetry run --no-interaction -- mike deploy --push --update-aliases v${{ needs.create-tag.outputs.version }} latest