Merge branch 'main' of https://github.com/MichaelAkridge-NOAA/jetstream #7
This file contains hidden or 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: Upload Python Package to PyPI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| jobs: | |
| pypi-publish: | |
| name: Publish release to PyPI | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/noaa-jetstream | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install bumpversion setuptools wheel twine build | |
| - name: Configure Git identity | |
| run: | | |
| git config --global user.email "action@github.com" | |
| git config --global user.name "GitHub Action" | |
| - name: Bump version (patch) | |
| run: | | |
| bumpversion --config-file bumpversion.cfg patch | |
| git push origin main --follow-tags | |
| - name: Verify version was updated | |
| run: | | |
| echo "Version in setup.py:" | |
| grep "version=" setup.py | |
| echo "Version in pyproject.toml:" | |
| grep "version =" pyproject.toml | |
| - name: Build package | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |