Skip to content

fixing the workflow to see github tags #3

fixing the workflow to see github tags

fixing the workflow to see github tags #3

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 (runs only if test job passes)
release:
runs-on: ubuntu-latest
needs: test # only run if tests passed
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; import setuptools; f=open('setup.py'); print(re.search(r'version\s*=\s*[\"\\'](.+?)[\"\\']', f.read()).group(1))")
echo "Version=${VERSION}" >> $GITHUB_ENV
# in YAML
- name: Check if version changed
id: version_check
run: |
git fetch --tags # make sure all remote tags are available
LAST_TAG=$(git describe --tags --abbrev=0 || echo "0.0.0")
echo "Last tag: $LAST_TAG"
echo "Current version: $VERSION"
if [ "$LAST_TAG" = "v$VERSION" ]; then
echo "Version not changed, skipping release."
exit 78
fi
- name: Build distribution
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}