Skip to content

Build

Build #92

Workflow file for this run

name: Build
on:
workflow_run:
workflows:
- Testing
types:
- completed
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install twine jinja2
- name: Get short commit hash
id: get_commit_hash
run: echo "data=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get latest tag
id: get_latest_tag
run: echo "data=$(git describe --tags --abbrev=0 ${{ steps.get_commit_hash.outputs.data }})" >> $GITHUB_OUTPUT
- name: Set package version
id: pkg_version
run: echo "data=$(echo ${{ steps.get_latest_tag.outputs.data }}.post0+${{ steps.get_commit_hash.outputs.data }} | cut -c2- )" >> $GITHUB_OUTPUT
- name: Build Python package
run: |
python -c 'import jinja2;jinja2.Template(open("setup.j2").read()).stream(version="${{ steps.pkg_version.outputs.data }}").dump("setup.py")'
python setup.py sdist bdist_wheel