Skip to content

bumping version

bumping version #7

Workflow file for this run

name: PyUIKit Testing + Release
on:
push:
branches: [ main ]
jobs:
# 1️⃣ Test job
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e . # editable install
pip install pytest
- name: Run tests
run: pytest tests
# 2️⃣ Release job
release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Get current version from setup.py
id: get_version
run: |
VERSION=$(python -c "import re; f=open('setup.py'); print(re.search(r'version\s*=\s*[\"\\'](.+?)[\"\\']', f.read()).group(1))")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Read release flags
id: release_flags
run: |
FLAGS=$(python -c "from release_flag import UPLOAD_TO_PYPI, CREATE_TAG; print(f'{UPLOAD_TO_PYPI},{CREATE_TAG}')")
IFS=',' read UPLOAD TAG <<< "$FLAGS"
echo "UPLOAD_TO_PYPI=$UPLOAD" >> $GITHUB_ENV
echo "CREATE_TAG=$TAG" >> $GITHUB_ENV
- name: Build distribution
if: env.UPLOAD_TO_PYPI == 'True' || env.CREATE_TAG == 'True'
run: python -m build
- name: Publish to PyPI
if: env.UPLOAD_TO_PYPI == 'True'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create Git tag
if: env.CREATE_TAG == 'True'
env:
VERSION: ${{ env.VERSION }}
GH_PAT: ${{ secrets.GH_PAT }} # Use PAT secret
run: |
TAG="v$VERSION"
echo "Creating Git tag $TAG using PAT"
git config user.name "github-actions"
git config user.email "actions@github.com"
# use PAT for pushing
git remote set-url origin https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
- name: Create GitHub Release
if: env.CREATE_TAG == 'True'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload distributions to GitHub Release
if: env.CREATE_TAG == 'True'
uses: softprops/action-gh-release@v1
with:
files: dist/* # upload all built binaries (.whl and .tar.gz)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}