Build, Release and Publish to PyPI #20
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: Build, Release and Publish to PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
contributors: | |
description: 'Contributors for this release' | |
required: false | |
default: '' | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
build-and-release: | |
name: Build, Release, and Publish to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install pypa/build | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install build --user | |
- name: Read release version | |
id: read_version | |
run: | | |
VERSION=$(python3 -c 'import src.patcher.__about__ as about; print(about.__version__)') | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Build binary wheel and source tarball | |
run: python3 -m build | |
- name: Store distribution package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: patcher-${{ env.VERSION }} | |
path: dist/ | |
- name: Publish package to PyPI | |
id: publish_pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Get Changelog updates | |
id: changelog_reader | |
uses: mindsers/[email protected] | |
with: | |
validation_depth: 100 | |
version: v${{ env.VERSION }} | |
- name: Generate changelog | |
id: changelog | |
uses: metcalfc/[email protected] | |
with: | |
myToken: ${{ secrets.GITHUB_TOKEN }} | |
reverse: 'true' | |
- name: Create Release | |
id: create_release | |
if: ${{ steps.publish_pypi.outcome == 'success' }} | |
uses: softprops/[email protected] | |
with: | |
name: Patcher ${{ env.VERSION }} | |
tag_name: v${{ env.VERSION }} | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
./dist/*.tar.gz | |
./dist/*.whl | |
body: | | |
# Patcher Release Notes | |
This release has been automatically generated by a GitHub Action. | |
For detailed installation instructions, please refer to the [Docs](https://patcher.liquidzoo.io) or the [README](https://github.com/liquidz00/Patcher/blob/main/README.md) | |
## Changelog for this release | |
This amended changelog is specific to this release. View the [full changelog](https://github.com/liquidz00/Patcher/blob/main/CHANGELOG.md) for all details. | |
${{ steps.changelog_reader.outputs.changes }} | |
## Changes | |
${{ steps.changelog.outputs.changelog }} | |
### Contributors | |
${{ github.event.inputs.contributors }} |