Bump v0.24.1 #33
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: Release on tag | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
inputs: | |
version: | |
description: The version to publish | |
required: true | |
gitRef: | |
description: The git ref to build against | |
required: false | |
pypi: | |
description: Release to PyPI | |
type: boolean | |
default: true | |
docs: | |
description: Publish updated documentation | |
type: boolean | |
default: true | |
github: | |
description: Draft GitHub release | |
type: boolean | |
default: true | |
testpypi: | |
description: Release to Test PyPI | |
type: boolean | |
default: false | |
jobs: | |
test: | |
uses: ./.github/workflows/tests.yaml | |
getversion: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.pkgVersion }} | |
gitRef: ${{ steps.get_version.outputs.gitRef }} | |
steps: | |
- name: Get version | |
id: get_version | |
run: | | |
version="" | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ] | |
then | |
version="${{ github.event.inputs.version }}" | |
else | |
version="$GITHUB_REF_NAME" | |
fi | |
echo "pkgVersion=$version" >> $GITHUB_OUTPUT | |
echo "Version: $version" | |
gitRef="" | |
if [ "${{ github.event.inputs.gitRef }}" != "" ] | |
then | |
gitRef="${{ github.event.inputs.gitRef }}" | |
else | |
gitRef="$version" | |
fi | |
echo "gitRef=$gitRef" >> $GITHUB_OUTPUT | |
echo "GIT Ref: $gitRef" | |
build: | |
needs: [test, getversion] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.getversion.outputs.gitRef }} | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install .[dist] | |
- name: Build | |
run: | | |
python -m build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: | | |
dist/screen_brightness_control*.whl | |
dist/screen_brightness_control*.tar.gz | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: release-env | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Publish to Test PyPI | |
if: ${{ inputs.testpypi == true }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
packages-dir: ./ | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPI | |
if: ${{ inputs.pypi == true || github.event_name == 'push' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: ./ | |
- name: Draft release | |
if: ${{ inputs.github == true || github.event_name == 'push' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: "./screen_brightness_control*" | |
name: "${{ needs.getversion.outputs.version }}" | |
tag_name: ${{ needs.getversion.outputs.version }} | |
docs: | |
if: ${{ inputs.docs == true || github.event_name == 'push' }} | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.getversion.outputs.gitRef }} | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install Dependencies | |
run: | | |
python -m pip install .[docs] | |
python -m pip install git+https://github.com/Crozzers/pdoc.git@lesser-qualified-links | |
- name: Checkout docs | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: docs/docs | |
- name: Generate docs | |
run: | | |
make docs | |
- name: Configure Git | |
working-directory: docs/docs | |
run: | | |
git config --global user.name "Github Actions [Bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
- name: Commit and Push | |
working-directory: docs/docs | |
run: | | |
git add -A | |
git commit -m "Bump $VERSION" | |
git push | |
env: | |
VERSION: ${{ needs.getversion.outputs.version }} |