-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (106 loc) · 3.72 KB
/
docs.yml
File metadata and controls
118 lines (106 loc) · 3.72 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
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
112
113
114
115
116
117
118
name: Docs
on:
push:
branches:
- master
- main
pull_request:
branches:
- '**'
env:
SITE_DIR: "gh-pages"
jobs:
build_site:
name: "Build site with Antora"
runs-on: [ubuntu-22.04]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Generate site using antora site action"
uses: kameshsampath/antora-site-action@master
with:
antora_playbook: site.yml
- name: "Upload generated site"
uses: actions/upload-artifact@v4
with:
name: site
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
deploy_site:
permissions:
contents: write
pull-requests: write
repository-projects: write
id-token: write
runs-on: [ubuntu-22.04]
needs: [build_site]
name: "Deploy GitHub Pages"
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download generated site
uses: actions/download-artifact@v4
with:
name: site
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "${{ env.SITE_DIR }}"
keep_files: true
commit_message: "[CI] Publish Documentation for ${{ github.sha }}"
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# Based on : https://daiyi.co/blog/pr-previews-for-github-pages/
deploy_preview:
permissions:
contents: write
pull-requests: write
repository-projects: write
id-token: write
env:
PR_PATH: pull-${{ github.event.number }}
runs-on: [ ubuntu-22.04 ]
needs: [ build_site ]
name: "Deploy preview for PR"
if: github.event_name == 'pull_request'
steps:
- name: Comment on PR
uses: hasura/comment-progress@v2.3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "Starting deployment of preview for ${{ github.event.pull_request.head.sha }} ⏳..."
- name: Set base URL for preview
run: echo "BASE_URL=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH }}" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
- name: Download generated site
uses: actions/download-artifact@v4
with:
name: site
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
- name: Deploy PR preview
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "${{ env.SITE_DIR }}"
destination_dir: "${{ env.PR_PATH }}"
commit_message: "[CI] Publish Preview for PR #${{ github.event.number }}"
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Update comment
uses: hasura/comment-progress@v2.3.0
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 }} ✨
Changes may take a few minutes to propagate.
The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}