-
Notifications
You must be signed in to change notification settings - Fork 7
131 lines (115 loc) · 3.14 KB
/
workflow.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build and publish package and docs
on:
push:
branches:
- master
tags:
- v[0-9].[0-9]+.[0-9]+
pull_request:
branches:
- master
jobs:
build:
name: Install and build
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v4
-
name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
-
name: Install dependencies
run: |
python -m pip install wheel # https://stackoverflow.com/questions/34819221
python -m pip install cython
-
name: Install
run: |
python -m pip install --no-cache-dir -e .[dev]
python -c "from setuptools_scm import get_version;get_version('.', write_to='src/rapid_clay_formations_fab/_version.py')"
-
name: Test
run: |
invoke test
-
name: Build docs
run: |
invoke docs
-
name: Upload docs for other jobs
uses: actions/upload-artifact@v2
with:
name: docs-dir
path: dist/docs/
if-no-files-found: error
retention-days: 1
-
name: Build package
run: |
python setup.py clean --all sdist bdist_wheel
-
name: Upload package artifacts for other jobs
uses: actions/upload-artifact@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
name: dist-files
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
retention-days: 1
publish_docs:
name: Publish docs
needs: build
if: github.event_name == 'push' && ! startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
-
name: Download docs directory from build job
uses: actions/download-artifact@v4
with:
name: docs-dir
path: docs
-
name: Publish docs on branch gh-pages
uses: crazy-max/[email protected]
with:
target_branch: gh-pages
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_pkg:
name: Publish package on pypi and GitHub
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
-
name: Checkout code # This is needed for creating release on GitHub
uses: actions/checkout@v4
-
name: Download dist directory from build job
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist
-
name: Upload and release package on PyPi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
-
name: Create GitHub release and upload assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
dist/*.whl
dist/*.tar.gz