Skip to content

Workflow file for this run

name: Build & Upload Python Package
on:
release:
types: [published]
jobs:
Setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Version
id: set-version
env:
VERSION: ${{ github.ref_name }}
run: |
if grep -c -E '^v[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}$' <<< ${VERSION}; then
VERSION=$(sed 's/^.\{1\}//g' <<< ${VERSION})
else
echo "This branch shouldn't be build: ${VERSION}"
exit 1
fi
echo "version=$(echo ${VERSION})" >> $GITHUB_OUTPUT
Deploy:
runs-on: ubuntu-latest
needs: Setup
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
env:
VERSION: ${{ needs.Setup.outputs.version }}
run: python -m build --wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1