Skip to content

Update precommit configurations and testing suite #30

Update precommit configurations and testing suite

Update precommit configurations and testing suite #30

Workflow file for this run

name: Deploy
on:
pull_request:
types: [closed]
jobs:
update_version:
runs-on: ubuntu-latest
# Check if the pull request was merged or a new tag was created
if: github.event.pull_request.merged == true || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# Allow the action to push to the repository
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Run Version Update Script
id: update_version
run: |
version=$(python3 .github/scripts/update_version.py)
if git diff --quiet HEAD^ HEAD; then
echo "No changes detected, exiting."
echo "status=no_changes" >> $GITHUB_OUTPUT
exit 0
fi
echo "version=$version" >> $GITHUB_OUTPUT
- name: Commit and Push Changes
if: steps.update_version.outputs.status != 'no_changes'
run: |
git checkout ${{ github.event.pull_request.base.ref }}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add pyproject.toml
git commit -m "Update version to ${{ steps.update_version.outputs.version }}" --no-verify
git push origin
build_and_publish:
runs-on: ubuntu-latest
needs: update_version
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip3 install build twine
- name: Build Package
run: python3 -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}