-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (88 loc) · 3.12 KB
/
release.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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check version
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
VERSION=$(echo "$GITHUB_REF_NAME" | sed 's/^v//')
CURR =$(cat pyproject.toml | grep ^version | sed 's/version = "\(.*\)"/\1/')
if [ "$VERSION" != "$CURR" ]; then
echo "Error: VERSION ($VERSION) and CURR ($CURR) do not match."
exit 1
else
echo "VERSION ($VERSION) matches CURR ($CURR). Proceeding."
fi
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.ref_name }}
path: dist
build-docs:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install mdbook
run: cargo install --git https://github.com/rust-lang/mdBook.git mdbook
- name: Build docs
run: bash ./scripts/docs/build.sh
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: book
deploy-docs:
needs: build-docs
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
create-release:
needs: deploy-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: dist-${{ github.ref_name }}
path: dist
- name: Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
body_path: CHANGELOG.md
files: dist/*
make_latest: true