-
Notifications
You must be signed in to change notification settings - Fork 35
101 lines (79 loc) · 3.02 KB
/
deploy.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
name: deploy
on:
workflow_run:
workflows: [testing]
types: [completed]
jobs:
deploy-docs:
# only run if commit is a push to master and the testing finished
if: ${{ github.repository_owner == 'fermisurfaces' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v0.') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Install pandoc
run: sudo apt-get install pandoc
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy wheel packaging Cython
pip install .[strict,docs]
- name: Build
run: sphinx-build docs docs_build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs_build/
deploy-pypi:
# only run if commit is a push to master, the testing finished, and tagged as version
if: ${{ github.repository_owner == 'fermisurfaces' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.head_branch, 'v0.') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build
run: |
pip install build
python -m build
- name: Remove newline from github secret
run: echo "PYPI_PASSWORD=$(echo -n ${{ secrets.PYPI_PASSWORD }})" >> $GITHUB_ENV
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ env.PYPI_PASSWORD }}
deploy-github:
runs-on: ubuntu-latest
needs:
- deploy-pypi
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Write release info
run: |
awk -e 'BEGIN {p = 0} {a = 0 }; /^## v\d*.\d*.\d*./ { p += 1; a = 1}; p + a == 1 { print } ' CHANGELOG.md | sed -e '1,1d' | sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' > release_info.txt
echo "" >> release_info.txt
awk '/CONTRIBUTOR SECTION/{f=1; c=0} f' CHANGELOG.md >> release_info.txt
- name: Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.workflow_run.head_branch }}
release_name: ${{ github.event.workflow_run.head_branch }}
body_path: release_info.txt
draft: false
prerelease: false