-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (88 loc) · 2.44 KB
/
release.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release
on:
push:
tags:
- v*
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
# Assert git and python versions match
pip install -e .
VERSION_PY=$(python3 -c "from xplt import __version__;print('v' + __version__)")
echo "Python version: $VERSION_PY"
VERSION_GIT=$(git describe --tags)
echo "Git version tag: $VERSION_GIT"
if [ "$VERSION_GIT" != "$VERSION_PY" ] ; then
echo "Version mismatch!"
exit 1
fi
pypi-test:
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install build
- name: Build
run: |
python -m build
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
ready:
needs: [checks, pypi-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
VERSION=$(git describe --tags)
echo "Version: $VERSION"
if [[ $VERSION =~ v[0-9]+(\.[0-9]+)*$ ]] ; then
echo "Ready for publication"
else
echo "Not publishing dirty versions"
exit 1
fi
docs-publish:
needs: ready
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
pip install -e .
pip install -r docs/requirements.txt
- name: Sphinx build
run: |
sphinx-build docs _build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
pypi-publish:
needs: ready
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install build
- name: Build
run: |
python -m build
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}