-
Notifications
You must be signed in to change notification settings - Fork 5
124 lines (121 loc) · 4.88 KB
/
Copy pathrelease-docs.yml
File metadata and controls
124 lines (121 loc) · 4.88 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
119
120
121
122
123
124
name: release-docs
on:
workflow_dispatch:
inputs:
tag:
description: 'GeoMesa release tag'
required: true
type: string
env:
JAVA_VERSION: 25
JAVA_RUNTIME_VERSION: 17
MAVEN_CLI_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dtest.fork.count=1 --batch-mode
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout GeoMesa source
uses: actions/checkout@v4
with:
repository: locationtech/geomesa
ref: ${{ github.event.inputs.tag }}
path: geomesa
- name: Configure git user
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '7715322+elahrvivaz@users.noreply.github.com'
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
cache: maven
java-version: |
${{ env.JAVA_RUNTIME_VERSION }}
${{ env.JAVA_VERSION }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Python dependencies
working-directory: ./geomesa
run: |
python -m pip install --upgrade pip
pip install -r ./docs/requirements.txt
- name: Set environment
run: |
TAG="${{ github.event.inputs.tag }}"
RELEASE="${TAG#geomesa-}"
RELEASE_SHORT="${RELEASE%.*}"
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
echo "RELEASE_SHORT=$RELEASE_SHORT" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v4
with:
path: geomesa.github.io
sparse-checkout: |
documentation/${{ env.RELEASE_SHORT }}
documentation/stable
_includes
_config.yml
versions.json
- name: Prep docs directory
working-directory: ./geomesa.github.io
run: |
# move current docs to a versioned folder
if [[ -d "documentation/$RELEASE_SHORT" ]]; then
# new bug fix on older release
rm -r "documentation/$RELEASE_SHORT/*"
# update intra-docs links
sed -i "s/{\"path\":\"$RELEASE_SHORT\",.*/{\"path\":\"$RELEASE_SHORT\",\"name\":\"$RELEASE\"},/" versions.json
else
LAST_RELEASE="$(grep stableVersion: _config.yml | awk '{ print $2 }' | sed "s/[\"', ]//g")"
if [[ -z "$LAST_RELEASE" ]]; then
echo "Error: unable to determine last release version"
exit 1
fi
LAST_RELEASE_SHORT="${LAST_RELEASE%.*}"
if [[ "$LAST_RELEASE_SHORT" == "$RELEASE_SHORT" ]]; then
# new bug fix on latest release
rm -r "documentation/$RELEASE_SHORT/*"
# update intra-docs links
sed -i "s/{\"path\":\"stable\",.*/{\"path\":\"stable\",\"name\":\"$RELEASE (latest)\"},/" versions.json
else
# new major/minor release
mkdir "documentation/$RELEASE_SHORT/"
pushd documentation
rm stable
ln -s "$RELEASE_SHORT" stable
popd
# add link to previous docs
sed -i "s|<li class=\"dropdown-header\">Previous Releases</li>|\0\n <li><a href=\"/documentation/${LAST_RELEASE_SHORT}/\">${LAST_RELEASE}</a></li>|" _includes/header.html
# update intra-docs links
sed -i "s/{\"path\":\"stable\",.*/{\"path\":\"stable\",\"name\":\"$RELEASE (latest)\"},\n {\"path\":\"$LAST_RELEASE_SHORT\",\"name\":\"$LAST_RELEASE\"},/" versions.json
fi
# update 'stable version'
sed -i "s/^stableVersion:.*/stableVersion: \"$RELEASE\"/" _config.yml
fi
- name: Build docs
working-directory: ./geomesa
run: mvn $MAVEN_CLI_OPTS clean install -Pdocs -pl docs
- name: Copy docs
run: cp -r ./geomesa/docs/target/html/* "./geomesa.github.io/documentation/$RELEASE_SHORT/"
- name: Set site URL
working-directory: ./geomesa
# update the pom url so that dependency links work
run: sed -i "s|<url>https://www.geomesa.org/</url>|<url>https://www.geomesa.org/documentation/$RELEASE_SHORT/site/</url>|" pom.xml
- name: Run scoverage
working-directory: ./geomesa
run: mvn $MAVEN_CLI_OPTS clean install -Pscoverage
- name: Build site
working-directory: ./geomesa
run: mvn $MAVEN_CLI_OPTS generate-sources site -Psite
- name: Stage site
working-directory: ./geomesa
run: mvn $MAVEN_CLI_OPTS site:stage -DstagingDirectory="$PWD/../geomesa.github.io/documentation/$RELEASE_SHORT/site/"
- name: Commit docs
working-directory: ./geomesa.github.io
run: |
git add documentation
git add -u
git commit -m "Updating docs for ${RELEASE}"
git push origin main