Fixup Documentation #3
Workflow file for this run
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: Generate a Release | |
on: | |
push: | |
tags: | |
- 'v[0-9].[0-9]+.[0-9]+' | |
- '!v[0-9].[0-9]+.[0-9]+rc[0-9]+' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
get-python-version: | |
name: Get Latest Python Version | |
runs-on: ubuntu-latest | |
outputs: | |
highest-version: ${{ steps.get-language-versions.outputs.latest-versions }} | |
steps: | |
- name: Get Required Version | |
uses: ActionsToolbox/get-language-versions-action@446919617fd774095b5dd3ed71c39dd3fd0d8f4f # v0.1.3 | |
id: get-language-versions | |
with: | |
language: "python" | |
highest-only: true | |
get-python-versions: | |
name: Get Python Versions (>= 3.9) | |
runs-on: ubuntu-latest | |
outputs: | |
version-matrix: ${{ steps.get-language-versions.outputs.latest-versions }} | |
steps: | |
- name: Get Required Versions | |
uses: ActionsToolbox/get-language-versions-action@446919617fd774095b5dd3ed71c39dd3fd0d8f4f # v0.1.3 | |
id: get-language-versions | |
with: | |
language: "python" | |
min-version: 3.9 | |
remove-patch-version: true | |
run-tests: | |
name: Pytest | |
needs: get-python-versions | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-versions: ${{ fromJson(needs.get-python-versions.outputs.version-matrix) }} | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Setup Python ${{ matrix.python-versions }} | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: ${{ matrix.python-versions }} | |
- name: Upgrade Pip | |
run: python -m pip install --upgrade pip | |
- name: Install Build Tools | |
run: pip install setuptools wheel | |
- name: Build the Package | |
run: python setup.py sdist bdist_wheel | |
- name: Install the Package | |
run: pip install dist/*.whl | |
- name: Install Pytest | |
run: pip install pytest pytest-mock | |
- name: Run Pytest | |
run: pytest --no-header -vv | |
build-and-publish: | |
name: Build & publish to PyPI | |
runs-on: ubuntu-latest | |
needs: | |
- run-tests | |
- get-python-version | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Setup Python ${{ needs.get-python-version.outputs.highest-version }} | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: ${{ needs.get-python-version.outputs.highest-version }} | |
- name: Update Pip | |
run: python -m pip install --upgrade pip | |
- name: Install Required Tooling | |
run: pip install setuptools wheel twine | |
- name: Build Binary Wheel & Source Tarball | |
run: python setup.py sdist bdist_wheel | |
- name: Verify Binary Wheel & Source Tarball | |
run: twine check dist/* | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload dist/* | |
set-release-version: | |
name: Set Release Version | |
runs-on: ubuntu-latest | |
outputs: | |
release-version: ${{ steps.set-release-version.outputs.release-version }} | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
- name: Set the Release Version | |
id: set-release-version | |
run: | | |
echo "release-version=${GITHUB_REF#refs/*/}" >> "${GITHUB_OUTPUT}" | |
create-release: | |
name: Create a Release | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- run-tests | |
- set-release-version | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
- name: Generate Changelog | |
uses: Bullrich/generate-release-changelog@6b60f004b4bf12ff271603dc32dbd261965ad2f2 # v2.0.2 | |
id: Changelog | |
env: | |
REPO: ${{ github.repository }} | |
- name: Create a Release | |
id: create_release | |
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ github.ref }} | |
name: ${{ needs.set-release-version.outputs.release-version }} | |
body: ${{ steps.Changelog.outputs.changelog }} | |
draft: false | |
prerelease: false |