-
Notifications
You must be signed in to change notification settings - Fork 24
79 lines (74 loc) · 2.45 KB
/
build.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
name: Build docs with Antora
on:
push:
branches:
- main
env:
SITE_DIR: 'stargate'
SUB_DIR: 'latest'
jobs:
build_site:
name: "Build site with Antora"
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Java for gradle
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Switch antora.yml symlink
run: |
FILE=antora.yml
cd $GITHUB_WORKSPACE/docs-src/stargate-core
if [ -f "$FILE" ]; then
rm antora.yml;
echo "antora.yml removed"
fi
ln -s antora-stargate.yml antora.yml
cd $GITHUB_WORKSPACE/docs-src/stargate-develop
if [ -f "$FILE" ]; then
rm antora.yml;
echo "antora.yml removed"
fi
ln -s antora-stargate.yml antora.yml
- name: Setup gradle
uses: gradle/gradle-build-action@v3
- name: Execute gradle build to run antora
run: ./gradlew antora
- name: "Fix attachments"
run: |
sudo mv $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/_attachments $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/attachments
sudo sed -i 's/_attachments/attachments/g' $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/api.html
ls -ltra $GITHUB_WORKSPACE/build/$SITE_DIR
grep attachment $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/api.html
- name: Upload generated site
uses: actions/upload-artifact@v4
with:
name: site
path: "${{ github.workspace }}/build/${{ env.SITE_DIR }}"
deploy_site:
runs-on: [ubuntu-latest]
needs: [build_site]
name: "Deploy GitHub Pages"
steps:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: 16
- name: Checkout
uses: actions/checkout@v3
- name: Download generated site
uses: actions/download-artifact@v4
with:
name: site
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
# ACCESS_TOKEN: # optional
token: "${{ github.token}}"
folder: "${{ env.SITE_DIR }}"
branch: 'gh-pages'
commit-message: "[CI] Publish documentation for ${{ github.sha }}"