-
Notifications
You must be signed in to change notification settings - Fork 30
96 lines (88 loc) · 3.83 KB
/
deploy-preview.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
name: Pull request Deploy preview
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
paths-ignore:
- '.github/**'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
concurrency: "deploy-preview"
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: peter-evans/find-comment@v3
id: find-comment
name: Find Comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: gh-pages-deploy
- uses: peter-evans/create-or-update-comment@v4
id: comment
name: Create initial comment
with:
body: |-
## Deploy Preview
Building preview of Pull request. Please wait...
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.BOT }}
edit-mode: replace
- uses: actions/checkout@v4
name: Checkout Code
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- uses: actions/setup-python@v5
name: Setup Python
with:
python-version: 3.x
- name: Install depencencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements.txt
- name: Build docs
run: mkdocs build
- uses: peaceiris/actions-gh-pages@v4
name: Deploy pages
with:
personal_token: ${{ secrets.BOT }}
publish_dir: ./site
destination_dir: ./${{ github.repository }}/${{ github.event.pull_request.number }}
external_repository: gh-pages-deploy/Deploy-Previews
full_commit_message: 'Pushing deploy preview for Pull request ${{ github.event.pull_request.number }} from ${{ github.repository }}'
- name: Delay comment update by 30 seconds
run: sleep 30s
shell: bash
- uses: peter-evans/create-or-update-comment@v4
name: Update comment.
with:
body: |-
## Deploy Preview
Deploy-Preview complete!
| Name | Link |
| ------ | ------------------------------------------------------------------------------------------------------------------ |
| Commit | ${{ github.event.pull_request.head.sha }} |
| Link | https://gh-pages-deploy.github.io/Deploy-Previews/${{ github.repository }}/${{ github.event.pull_request.number }} |
| Logs | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
comment-id: ${{ steps.comment.outputs.comment-id }}
edit-mode: replace
token: ${{ secrets.BOT }}
- if: ${{ failure() }}
uses: peter-evans/create-or-update-comment@v4
name: Update comment.
with:
body: |-
## Deploy Preview
Deploy-Preview failed!
| Name | Link |
| ------ | -------------------------------------------------------------------------------------------------- |
| Commit | ${{ github.event.pull_request.head.sha }} |
| Logs | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
comment-id: ${{ steps.comment.outputs.comment-id }}
edit-mode: replace
token: ${{ secrets.BOT }}