Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/publish-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Alpha to PyPI 📦

on:
push:
branches:
- main

jobs:
publish-alpha:
name: Build and publish alpha release to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Generate alpha version
id: version
run: |
# Extract current version from version.py
CURRENT_VERSION=$(grep -oP "__version__ = '\K[0-9.]+(?=')" SpiffWorkflow/version.py)

# Split version into major.minor.patch
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)

# Increment patch version
NEXT_PATCH=$((PATCH + 1))

# Get timestamp for unique alpha version
TIMESTAMP=$(date +%s)

# Generate alpha version: major.minor.(patch+1)a<timestamp> (PEP 440 compliant, PyPI compatible)
ALPHA_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}a${TIMESTAMP}"

echo "alpha_version=${ALPHA_VERSION}" >> $GITHUB_OUTPUT
echo "Generated alpha version: ${ALPHA_VERSION}"

- name: Update version.py with alpha version
run: |
echo "__version__ = '${{ steps.version.outputs.alpha_version }}'" > SpiffWorkflow/version.py
cat SpiffWorkflow/version.py

- name: Install pypa/build
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
username: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Loading