Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Python 🐍 Package to PyPI

on:
push:
tags:
- 'v0.0.8' # e.g., v1.2.3
Comment thread
yunks128 marked this conversation as resolved.
Outdated
Comment thread
yunks128 marked this conversation as resolved.
Outdated

jobs:
publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Extract version from tag and update VERSION.txt
Comment thread
yunks128 marked this conversation as resolved.
Outdated
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
echo "$TAG_VERSION" > src/jpl/slim/VERSION.txt
echo "Updated src/jpl/slim/VERSION.txt to $TAG_VERSION"

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build wheel twine
Comment thread
yunks128 marked this conversation as resolved.
Outdated

- name: Build package
run: python -m build .

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,31 @@ pytest -v -s

### Publishing a New Version

To publish a new version of SLIM CLI to the Python Package Index, typically you'll update the `VERSION.txt` file; then do:
To publish a new version of SLIM CLI to the Python Package Index, follow these steps:

1. Create a Git tag for the new version:
```bash
# Create the tag (use the appropriate version number)
git tag v0.1.0

# Push the tag to the repository
git push origin v0.1.0
```

2. The GitHub Actions workflow will automatically:
- Extract the version from the tag
- Update the version file
- Build the package
- Publish it to PyPI

If you need to remove a tag (e.g., if there was an issue):
```bash
pip install build wheel twine
python3 -m build .
twine upload dist/*
```
# Remove the tag locally
git tag -d v0.1.0
Comment thread
yunks128 marked this conversation as resolved.
Outdated

(Note: this can and should eventually be automated with GitHub Actions.)
# Remove the tag from the remote repository
git push --delete origin v0.1.0
Comment thread
yunks128 marked this conversation as resolved.
Outdated
```

## License

Expand Down