Merge pull request #141 from iwishiwasaneagle/remove-pb3 #27
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
# Copyright 2023 Jan-Hendrik Ewers | |
# SPDX-License-Identifier: GPL-3.0-only | |
name: CD | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
setup-envs: | |
name: Set up the build names and such | |
runs-on: ubuntu-20.04 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Version | |
id: version | |
shell: bash | |
run: | | |
v=${GITHUB_REF##*/} | |
echo "Version: $v" | |
echo "::set-output name=version::$v" | |
- name: Check version | |
shell: bash | |
run: | | |
rx='^v([0-9]+\.){0,2}(\*|[0-9]+)$' | |
VERSION=${{steps.version.outputs.version}} | |
if [[ $VERSION =~ $rx ]]; then | |
echo "INFO:<-->Version $VERSION" | |
else | |
echo "ERROR:<->Unable to validate package version: '$VERSION'" | |
exit 1 | |
fi | |
generate-changelog: | |
name: Generate latest changelog | |
needs: setup-envs | |
runs-on: ubuntu-20.04 | |
outputs: | |
release_body: ${{ steps.release.outputs.release_body }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate latest changelog | |
uses: orhun/git-cliff-action@v3 | |
id: git-cliff-latest | |
with: | |
args: -vv --latest --strip header | |
env: | |
OUTPUT: CHANGELOG.md | |
- name: Check CHANGELOG isn't empty | |
run: | | |
if [ -z "$(cat CHANGELOG.md)" ] | |
then | |
exit 1 | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: changelog | |
path: CHANGELOG.md | |
build-python: | |
name: Build python | |
needs: setup-envs | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Build wheels | |
run: pip wheel -w wheelhouse . --no-deps | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
publish-pypi: | |
name: Publish on PyPi | |
needs: build-python | |
runs-on: ubuntu-20.04 | |
permissions: | |
id-token: write | |
environment: | |
name: jdrones | |
url: https://pypi.org/p/jdrones | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
publish-github: | |
name: Publish on GitHub | |
needs: [generate-changelog,build-python,setup-envs] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Download changelog | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body_path: CHANGELOG.md | |
files: | | |
dist/** | |
name: "Release ${{needs.setup-envs.outputs.version}}" | |
generate_release_notes: false | |
publish-gh-page: | |
name: Publish to Github Pages | |
needs: setup-envs | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
python-version: 3.11 | |
cache-dependency-path: | | |
requirements.txt | |
docs/requirements.txt | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y pandoc | |
pip install docstr-coverage -r docs/requirements.txt | |
- name: Build docs | |
run: | | |
PYTHONPATH=$PWD/src \ | |
sphinx-build --color \ | |
-b html \ | |
-d docs/_build/html docs docs/_build/html | |
- name: Build docstring coverage badge | |
run: | | |
docstr-coverage -p | |
mv *.svg docs/_build/html/_static | |
- name: Upload the docs | |
uses: JamesIves/github-pages-deploy-action@v4.5.0 | |
with: | |
branch: gh-pages | |
folder: docs/_build/html/ | |
clean-exclude: | | |
.nojekyll |