1
+ # Copyright (c) 2021, 2023, Oracle and/or its affiliates.
2
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
+ #
4
+ # Description
5
+ # Use Hugo to build static site and publish to gh-pages
6
+ #
7
+ name : " PublishGitHubPages"
8
+
9
+ on :
10
+ schedule :
11
+ - cron : ' 15 3 * * *'
12
+
13
+ defaults :
14
+ run :
15
+ shell : bash
16
+
17
+ jobs :
18
+ publish :
19
+ name : Publish
20
+ runs-on : ubuntu-latest
21
+
22
+ steps :
23
+ - name : Checkout branch
24
+ uses : actions/checkout@v3
25
+ with :
26
+ fetch-depth : 32
27
+ ref : release/4.0
28
+ path : branch-4.0
29
+
30
+ - name : Checkout branch
31
+ uses : actions/checkout@v3
32
+ with :
33
+ fetch-depth : 32
34
+ ref : release/3.4
35
+ path : branch-3.4
36
+
37
+ - name : Checkout gh-pages
38
+ uses : actions/checkout@v3
39
+ with :
40
+ ref : gh-pages
41
+ path : gh-pages
42
+ token : ${{ secrets.PUBLISH_SECRET }}
43
+
44
+ - name : Build and publish site
45
+ run : |
46
+ curl -fL -o hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v0.108.0/hugo_0.108.0_Linux-64bit.tar.gz"
47
+ tar -xf hugo.tar.gz
48
+ export PATH="$PWD:$PATH"
49
+ mkdir $GITHUB_WORKSPACE/WORK
50
+
51
+ cd $GITHUB_WORKSPACE/branch-4.0/documentation
52
+ echo "Building documentation for latest minor version..."
53
+ hugo -s site -d "$GITHUB_WORKSPACE/WORK" -b https://oracle.github.io/weblogic-kubernetes-operator
54
+ echo "Copying static files into place..."
55
+ cp -R charts domains "$GITHUB_WORKSPACE/WORK"
56
+
57
+ cd $GITHUB_WORKSPACE/branch-3.4/documentation
58
+ echo "Building documentation for older minor version..."
59
+ hugo -s site -d "$GITHUB_WORKSPACE/WORK/3.4" -b https://oracle.github.io/weblogic-kubernetes-operator/3.4
60
+
61
+ cd $GITHUB_WORKSPACE/gh-pages
62
+ find . -maxdepth 1 -mindepth 1 -not -name '[0-9]*' -not -name '.git*' -exec rm -Rf {} \;
63
+ rm -Rf 3.4
64
+
65
+ cp -R $GITHUB_WORKSPACE/WORK/* .
66
+ git config --global user.name "github-actions[bot]"
67
+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
68
+ git add --all
69
+ git commit -m "Documentation update from publish GitHub Action"
70
+ git push origin gh-pages
0 commit comments