-
Notifications
You must be signed in to change notification settings - Fork 15
75 lines (61 loc) · 2.15 KB
/
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
name: Deploy docs to preview
on:
pull_request_target:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Comment on PR
uses: hasura/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "Starting deployment of preview ⏳..."
- uses: actions/checkout@v3
- name: Checkout PR head
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr
git checkout pr
- name: Set up Python
uses: actions/setup-python@v3
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build pages
run: make html
- name: Set PR preview path ENVVAR
run: |
echo "PR_PATH=pull/${{github.event.number}}" >> $GITHUB_ENV
- name: Set base URL for preview
run: |
echo "BASE_URL=https://freeipa.github.io/${{ env.PR_PATH}}/" >> $GITHUB_ENV
- name: Deploy to preview
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html/
destination_dir: ${{ env.PR_PATH }}
- name: Update PR preview comment
uses: hasura/comment-progress@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: |
A preview of ${{ github.event.pull_request.head.sha }} is uploaded and can be seen here:
🚀 ${{ env.BASE_URL }} 🚀
Please note that it may take a moment for the latest changes to be reflected.
- name: Update PR comment if job failed
uses: hasura/comment-progress@v2
if: failure()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "Something failed! Please check the action log for details."