-
Notifications
You must be signed in to change notification settings - Fork 14
115 lines (101 loc) · 3.52 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
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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Build website and document"
env:
versions: ("master" "0.5") # defines what versions of document should be updated
latest_version: "0.5" # defines what version docs/latest links to
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # deploy every day
jobs:
build-website:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Copy out old docs directory
run: |
git fetch origin asf-site:asf-site
git checkout asf-site
if [[ -d docs ]]
then
cp -r docs /tmp/docs
else
mkdir /tmp/docs
fi
- name: Create asf-site branch
run: |
git checkout master
git branch -D asf-site
git checkout --orphan asf-site
- name: Copy back docs directory
run: cp -r /tmp/docs docs
- name: Build pages
run: |
current_dir=$(pwd)
git submodule update --init --recursive
mv pages /tmp/paimon-pages
cp ./.github/workflows/pages.sh /tmp/paimon-pages/pages.sh
cd /tmp/paimon-pages
. ./pages.sh
cp -r target/* "$current_dir"
cd "$current_dir"
- name: Move out main site
run: |
mv main/* .
rm -rf main
- name: Clone Paimon repo
run: git clone https://github.com/apache/incubator-paimon.git /tmp/paimon
- name: Build docs
run: |
declare -a versions=${{ env.versions }}
current_dir=$(pwd)
cp ./.github/workflows/docs.sh /tmp/paimon/docs.sh
for version in "${versions[@]}"
do
# delete old document
rm -rf docs/"$version"
mkdir docs/"$version"
# build new document
cd /tmp/paimon
git checkout master
if [ "$version" != "master" ]
then
git checkout release-"$version"
fi
. ./docs.sh
# copy document to target directory
cp -r docs/target/* "$current_dir"/docs/"$version"
# clean up
git reset --hard HEAD
cd "$current_dir"
done
# - name: Copy latest version
# run: |
# latest_version=${{ env.latest_version }}
# rm -rf docs/latest
# cp -r docs/"$latest_version" docs/latest
- name: Push to github
run: |
git add -A
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git commit -m "Build website and document"
git push -f origin asf-site