-
Notifications
You must be signed in to change notification settings - Fork 41
134 lines (110 loc) · 3.65 KB
/
Copy pathpushToGEE.yml
File metadata and controls
134 lines (110 loc) · 3.65 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
125
126
127
128
129
130
131
132
133
134
name: Sync with GEE
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: gee-sync
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
mirror:
name: Generate library bundles and mirror to GEE
runs-on: ubuntu-latest
timeout-minutes: 30
env:
GEE_REPO_ADDRESS: ${{ secrets.GEE_REPO_ADDRESS }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Configure Git and GEE authentication
env:
GIT_COOKIE_VALUE: ${{ secrets.GIT_COOKIE_VALUE }}
run: |
set -euo pipefail
: "${GIT_COOKIE_VALUE:?GIT_COOKIE_VALUE secret is required}"
: "${GEE_REPO_ADDRESS:?GEE_REPO_ADDRESS secret is required}"
touch ~/.gitcookies
chmod 0600 ~/.gitcookies
printf 'earthengine.googlesource.com\tFALSE\t/\tTRUE\t2147483647\to\t%s\n' "${GIT_COOKIE_VALUE}" > ~/.gitcookies
git config http.cookiefile ~/.gitcookies
git config http.postBuffer 157286400
git config user.email "githubActionAutoMerge@no-one.com"
git config user.name "githubActionAutoMerge"
git config pull.rebase false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install generator dependencies
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install jsmin
- name: Generate aggregate library files
run: |
set -euo pipefail
python genearteOpenEEL.py
git add loadAll loadAll4py loadAllSF
if git diff --cached --quiet; then
echo "No generated library changes to commit."
else
git commit -m "update generated library bundles"
git push origin HEAD:master
fi
- name: Mirror repository to GEE
run: |
set -euo pipefail
git pull "https://earthengine.googlesource.com/${GEE_REPO_ADDRESS}" master --allow-unrelated-histories || {
git checkout --ours .
git add -u
git commit -m "autoMerge"
}
git push "https://earthengine.googlesource.com/${GEE_REPO_ADDRESS}" master
git push origin HEAD:master
docs:
name: Generate documentation
needs: mirror
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Generate documentation JSON
run: |
set -euo pipefail
git fetch origin gh-pages:gh-pages
git checkout gh-pages -- genearteOpenEEL_doc.py ee.js
python genearteOpenEEL_doc.py
node -e "var fs = require('fs'); eval(fs.readFileSync('./openEEL_doc').toString())"
cp doc.json "${RUNNER_TEMP}/doc.json"
- name: Publish documentation JSON
run: |
set -euo pipefail
git config user.email "githubActionAutoDoc@no-one.com"
git config user.name "githubActionAutoDoc"
git switch gh-pages
cp "${RUNNER_TEMP}/doc.json" doc.json
git add doc.json
if git diff --cached --quiet; then
echo "No documentation changes to commit."
else
git commit -m "docAutoUpdate"
git push origin gh-pages
fi