release & publish workflow #10
This file contains 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
# Publish package on release branch if it's tagged with 'v*' | |
name: release & publish workflow | |
# Controls when the action will run. | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
github_release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version from tag | |
id: tag_name | |
shell: bash | |
run: | | |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/[email protected] | |
with: | |
version: ${{ steps.tag_name.outputs.current_version }} | |
path: ./CHANGELOG.md | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
draft: false | |
prerelease: false | |
release: | |
name: Create Release | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-versions: [3.9] | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-versions }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Install dependencies | |
if: ${{ !matrix.tox-full-run }} | |
run: | | |
uv venv .venv | |
uv pip install '.' | |
- name: Build documentation | |
run: | | |
uv pip install -e '.[doc]' | |
uv run mkdocs build | |
- name: Publish documentation | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site | |
- name: Build wheels and source tarball | |
run: >- | |
uv build | |
- name: show temporary files | |
run: >- | |
ls -l | |
- name: Publish to PyPi | |
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }} |