release #4
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
name: release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
test-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- run: python -m pip install ".[dev]" | |
- run: mkdocs build --clean --strict | |
# Need to ensure we bump before we create any artifacts | |
bump: | |
runs-on: ubuntu-latest | |
needs: [test-docs] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: 1 # Essential to later commitizen | |
fetch-depth: 0 # Recommended by the action | |
token: ${{ secrets.PUSH_ACCESS }} | |
- run: git tag # Debug statement | |
- name: Create bump and changelog | |
uses: commitizen-tools/commitizen-action@master | |
id: cz | |
with: | |
github_token: ${{ secrets.PUSH_ACCESS }} | |
debug: true | |
changelog_increment_filename: changelog-increment.md | |
- run: | | |
mkdir changelog-output | |
mv changelog-increment.md changelog-output/changelog-increment.md | |
cat changelog-output/changelog-increment.md | |
- name: Upload the changelog | |
uses: actions/upload-artifact@v4 | |
with: | |
name: changelog | |
path: changelog-output | |
build: | |
needs: [bump] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before | |
fetch-tags: 1 | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: pip | |
- run: python -m pip install build | |
- run: python -m build --sdist | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-output | |
path: dist | |
docs: | |
needs: [bump] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- uses: actions/cache@v2 | |
with: | |
key: ${{ github.ref }} | |
path: .cache | |
- run: python -m pip install mkdocs-material mkdocs-autorefs mkdocs-glightbox mkdocs-literate-nav mkdocstrings[python] mkdocs-gen-files mkdocs-awesome-pages-plugin typing-extensions more-itertools pillow cairosvg mike markdown-exec | |
- run: mkdocs gh-deploy --force | |
release: | |
needs: [docs, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before | |
fetch-tags: 1 | |
fetch-depth: 0 | |
- name: Download the build artifiact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-output | |
path: dist | |
- run: ls -R dist | |
- name: Download the changelog | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog | |
path: changelog-output | |
- run: | | |
ls -R changelog-output | |
mv changelog-output/changelog-increment.md changelog-increment.md | |
cat changelog-increment.md | |
- name: "Create Github Release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
current_version=$(git tag | sort --version-sort | tail -n 1) | |
echo "Release for ${current_version}" | |
gh release create \ | |
--generate-notes \ | |
--notes-file changelog-increment.md \ | |
--verify-tag \ | |
"${current_version}" "dist/quicktunetool-${current_version}.tar.gz" | |
publish: | |
needs: [release] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-output | |
path: dist | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |