Merge pull request #189 from Ocean-Data-Lab/update_dep #61
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
# Publish archives to PyPI and TestPyPI using GitHub Actions | |
name: Publish to PyPI | |
# Only run for tagged releases and pushes to the master branch | |
on: | |
release: | |
types: | |
- published | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
publish-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
if: github.repository == 'Ocean-Data-Lab/ooipy' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# fetch all history so that setuptools-scm works | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: python -m pip install --upgrade hatch hatch-vcs | |
- name: Build source and wheel distributions | |
run: | | |
hatch build | |
echo "" | |
echo "Generated files:" | |
ls -lh dist/ | |
- name: Publish to Test PyPI | |
run: hatch publish -r test -u __token__ -a ${{ secrets.TEST_PYPI_API_TOKEN }} | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
run: hatch publish -u __token__ -a ${{ secrets.PYPI_API_TOKEN }} |