-
Notifications
You must be signed in to change notification settings - Fork 153
110 lines (92 loc) · 2.86 KB
/
python-publish.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: PyPI CI and docs
on:
release:
types: [ created ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, "3.10" ]
django-version: [ 3.1, 3.2, 4.0, 4.1 ]
steps:
- name: Install system dependencies (windows)
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
update: true
install: zlib
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python dev.py -no-container
pip install -q Django==${{ matrix.django-version }}
python -m pip install --upgrade pip
python setup.py install
- name: Test with pytest
run: |
python runtests.py
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
docs:
needs:
- test
- deploy
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Checkout branch
uses: actions/[email protected]
- name: Restore docs environment and build docs
run: |
python dev.py -no-container --with-docs
mkdocs build
- name: Commit documentation changes
run: |
git clone https://github.com/neutronX/django-markdownx.git --branch gh-pages --single-branch gh-pages
rm -rf gh-pages/docs
mkdir gh-pages/docs
cp -r docs/* gh-pages/docs/
cd gh-pages
VERSION=$(python setup.py -V)
echo ${VERSION} >> version
> .nojekyll
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentations" -a || true
echo "Documentations for v${VERSION} has been deployed."
# The above command will fail if no changes were present, so we ignore
# the return code.
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}