-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (42 loc) · 1.56 KB
/
pypi.yaml
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
47
48
49
50
51
52
53
54
---
name: PyPI
on:
push:
branches:
- master
paths:
- "**"
release:
types: [created, edited, published]
env:
ORG: opendatacube
IMAGE: wps
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Publish to Test PyPi
run: |
if [ -n "${TEST_PYPI_TOKEN}" ]; then
docker build -t ${ORG}/${IMAGE}:latest .
docker run --rm -i ${ORG}/${IMAGE}:latest bash -c "python setup.py bdist_wheel sdist; twine check ./dist/*; twine upload --verbose --non-interactive --disable-progress-bar --username=__token__ --password=${TEST_PYPI_TOKEN} --repository-url=${TWINE_REPOSITORY_URL} --skip-existing dist/*"
else
echo "Skipping upload as 'Test_PyPI_Token' is not set"
fi
env:
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
- name: Push to PyPI (tagged release only)
if: github.event_name == 'release'
run: |
if [ -n "${PYPI_TOKEN}" ]; then
docker build -t ${ORG}/${IMAGE}:latest .
docker run --rm -i ${ORG}/${IMAGE}:latest bash -c "python setup.py bdist_wheel sdist; twine check ./dist/*; twine upload --verbose --non-interactive --disable-progress-bar --username=__token__ --password=${PYPI_TOKEN} --skip-existing dist/*"
else
echo "Skipping upload as 'PyPI_Token' is not set"
fi
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}