-
Notifications
You must be signed in to change notification settings - Fork 91
57 lines (51 loc) · 1.54 KB
/
publish-github-pages.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
# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# Description
# Use Hugo to build static site and publish to gh-pages
#
name: "PublishGitHubPages"
on:
push:
branches:
- main
paths:
- 'documentation/**'
schedule:
- cron: '15 3 * * *'
defaults:
run:
shell: bash
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 32
path: main
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish site
run: |
curl -fL -o hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v0.82.0/hugo_0.82.0_Linux-64bit.tar.gz"
tar -xf hugo.tar.gz
export PATH="$PWD:$PATH"
mkdir $GITHUB_WORKSPACE/WORK
cd $GITHUB_WORKSPACE/main/documentation
./publish.sh -o $GITHUB_WORKSPACE/WORK
cd $GITHUB_WORKSPACE/gh-pages
rm -Rf *
cp -R $GITHUB_WORKSPACE/WORK/* .
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --all
git commit -m "Documentation update from publish GitHub Action"
git push origin gh-pages