Merge pull request #27 from affenull2345/systemd-service #7
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: Publish to PyPI | |
on: [push] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python distributions to PyPI | |
runs-on: ubuntu-latest | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Update package cache | |
run: sudo apt-get -yq update | |
- name: Install Deps for installing project | |
run: pip install wheel | |
- name: Install Deps with pip | |
run: pip install . | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python setup.py sdist bdist_wheel | |
- name: Check Tag | |
id: check-tag | |
# https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-releases | |
run: | | |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+a[0-9]+$ ]]; then | |
echo "match=prerelease" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$ ]]; then | |
echo "match=prerelease" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$ ]]; then | |
echo "match=release" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "match=release" >> $GITHUB_OUTPUT | |
else | |
echo "match=dirty" >> $GITHUB_OUTPUT | |
fi | |
- name: Print detected match | |
env: | |
MATCH: ${{ steps.check-tag.outputs.match }} | |
run: echo "Match is $MATCH" | |
- name: Publish distribution to Test PyPI | |
if: startsWith(github.ref, 'refs/tags/v') && (steps.check-tag.outputs.match == 'prerelease' || steps.check-tag.outputs.match == 'release') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') && steps.check-tag.outputs.match == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 |