-
Notifications
You must be signed in to change notification settings - Fork 7
46 lines (39 loc) · 1.12 KB
/
pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 }}