Skip to content

Commit

Permalink
Update FEZrs_PyPI_Publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aradfarahani authored Mar 1, 2025
1 parent d0a8f86 commit e57904a
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/FEZrs_PyPI_Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,45 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for setuptools_scm to detect version

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools_scm wheel twine build
- name: Determine version
run: |
VERSION=$(python setup.py --version) # Now setuptools_scm is installed
echo "Current version: $VERSION"
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Bump version (if needed)
- name: Automatically bump version
run: |
OLD_VERSION=${{ env.PACKAGE_VERSION }}
OLD_VERSION=$(python setup.py --version)
echo "Current version: $OLD_VERSION"
NEW_VERSION=$(echo $OLD_VERSION | awk -F. -v OFS=. '{$NF++;print}')
echo "New version: $NEW_VERSION"
# Update the VERSION file
echo "$NEW_VERSION" > VERSION
# Commit & push the new version
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
echo $NEW_VERSION > VERSION
git add VERSION
git commit -m "Bump version to $NEW_VERSION"
git tag $NEW_VERSION
git push origin $NEW_VERSION
git push
- name: Build PyPI package
run: python -m build
- name: Commit & Push the New Version
env:
GH_PAT: ${{ secrets.GH_PAT }} # Use the Personal Access Token (PAT)
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
- name: Publish to PyPI
git remote set-url origin https://x-access-token:$GH_PAT@github.com/${{ github.repository }}.git
git push origin main --tags
git push
- name: Build and Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload dist/*
run: |
python -m build
python -m twine upload dist/*

0 comments on commit e57904a

Please sign in to comment.