-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (44 loc) · 1.36 KB
/
generate_website_pr.yaml
File metadata and controls
45 lines (44 loc) · 1.36 KB
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
name: Generate website in PR
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'db/**'
- 'pyproject.toml'
- '.python-version'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 10
- uses: marceloprado/has-changed-path@v1.0.1
id: changed-front
with:
paths: src/ pyproject.toml .python-version
- name: Install the latest version of rye
uses: eifinger/setup-rye@v2
- name: Sync rye
run: rye sync --all-features
- name: Rebuild website
if: steps.changed-front.outputs.changed == 'true' || contains(github.event.pull_request.labels.*.name, 'rebuild')
run: rye run rebuild
- name: Build new pages
if: steps.changed-front.outputs.changed == 'false' && !contains(github.event.pull_request.labels.*.name, 'rebuild')
run: rye run build
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -a -m "Update website."
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}