Skip to content

Commit

Permalink
Updated pypi_upload.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick committed Sep 10, 2024
1 parent f6eea2d commit 32dc357
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,52 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Update Version and Upload Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

update-version:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install bump2version build twine
- name: Extract version from tag
id: extract_version
run: |
# Extract the version from the Git tag
tag=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///')
echo "VERSION=$tag" >> $GITHUB_ENV
- name: Update version in pyproject.toml
run: |
# Use bump2version to update version in pyproject.toml
bump2version --new-version $VERSION patch # or minor/major based on your needs
git commit -am "Update version to $VERSION"
git push
git push --tags
- name: Build package
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ pyvenv.cfg
.pyenv/
dist/*

pba.egg-info/
pba.egg-info/
setup.txt

0 comments on commit 32dc357

Please sign in to comment.