-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (76 loc) · 2.77 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- 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: Update version
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
VERSION=$(echo "$GITHUB_REF_NAME" | sed 's/^v//')
echo "Updating version to $VERSION"
sed -i "s|^version = .*|version = \"$VERSION\"|" pyproject.toml
cat pyproject.toml
- 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: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add pyproject.toml
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git commit -m "Update version to ${{ github.ref_name }}"
git push origin master
build-docs:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- 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