Skip to content

Testing auto bump action on release #108

Testing auto bump action on release

Testing auto bump action on release #108

Workflow file for this run

name: Push to PyPI
on:
release:
types: [released, prereleased]
jobs:
publish:
runs-on: ubuntu-latest
# Mandatory for publishing with a trusted publisher
# c.f. https://docs.pypi.org/trusted-publishers/using-a-publisher/
permissions:
id-token: write
env:
BRANCH: ${{ github.event.release.target_commitish }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install python-build and twine
run: |
uv pip install --system build twine
uv pip list --system
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- name: Update Version
run: |
sed -i "/version =/ s/= \"[^\"]*\"/= \"${{ env.RELEASE_VERSION }}\"/" pyproject.toml
- name: commit version-bump
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add ./pyproject.toml
# Check if there are changes to commit
if ! git diff --cached --quiet; then
echo "Changes detected, committing..."
git commit -m "Update version to ${{ env.RELEASE_VERSION }}" --no-verify
else
echo "No changes to commit"
fi
- name: Push commit
run: |
git push origin HEAD:$BRANCH
- name: Build a sdist and wheel
run: |
python -m build .
- name: Verify the distribution
run: twine check --strict dist/*
- name: List contents of sdist
run: python -m tarfile --list dist/servicex-*.tar.gz
- name: List contents of wheel
run: python -m zipfile --list dist/servicex-*.whl
- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: dist
- name: Publish distribution 📦 to PyPI
if: github.repository == 'ssl-hep/ServiceX_frontend'
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
print-hash: true