-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (71 loc) · 2.14 KB
/
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
name: Publish
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16.0'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build virtualenv
# PyPI package
- name: Build Python package
run: python -m build
- name: Publish Python package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Documentation
- name: Install doc dependencies
run: |
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Build documentation
run: |
python -m sphinx docs/ build/html -b html -D katex_prerender=1
- name: Deploy documentation to Github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/html
# Github release
- name: Read CHANGELOG
id: changelog
run: |
# Get bullet points from last CHANGELOG entry
CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//')
echo "Got changelog: $CHANGELOG"
# Support for multiline, see
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
{
echo 'body<<EOF'
echo "$CHANGELOG"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create release on Github
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}