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
name: Deploy to PyPI and Create GitHub Release | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
pip install -e . | |
- name: Extract version | |
id: get_version | |
run: | | |
version=$(python -c "import sys; sys.path.append('src'); from seekwellpandas import __version__; print(__version__)") | |
echo "VERSION=$version" >> $GITHUB_OUTPUT | |
- name: Build package | |
run: python -m build | |
- name: Publish package to PyPI | |
env: | |
TWINE_USERNAME: personnal | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload dist/* | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ steps.get_version.outputs.VERSION }} \ | |
--title "Release ${{ steps.get_version.outputs.VERSION }}" \ | |
--notes "Release notes for version ${{ steps.get_version.outputs.VERSION }}" \ | |
./dist/* | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |