-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Abarvisionco/main
Set up GitHub Actions for Automatic PyPI Publishing
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Set up Python environment | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
# Install dependencies for building and publishing | ||
- name: Install build tools | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build twine | ||
# Extract version from setup.py | ||
- name: Extract version from setup.py | ||
id: extract_version | ||
run: | | ||
version=$(python -c "exec(open('setup.py').read()); print(__version__)") | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
# Log the extracted version | ||
- name: Show extracted version | ||
run: echo "Extracted Version: ${{ env.VERSION }}" | ||
|
||
# Build the package | ||
- name: Build the package | ||
run: python -m build | ||
|
||
# Publish to PyPI | ||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters