@@ -45,20 +45,29 @@ jobs:
4545 xargs -a <(awk '! /^ *(#|$)/' "grass/.github/workflows/apt.txt") -r -- \
4646 sudo apt-get install -y --no-install-recommends --no-install-suggests
4747
48- - name : Set up Python
48+ - name : Set up Python (with cache)
49+ if : ${{ contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
50+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
51+ with :
52+ python-version : ${{ env.PYTHON_VERSION }}
53+ cache : pip # zizmor: ignore[cache-poisoning] Assuming push event is not used for tags
54+
55+ - name : Set up Python (no cache, use for release artifacts)
56+ if : ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
4957 uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
5058 with :
5159 python-version : ${{ env.PYTHON_VERSION }}
52- cache : pip
5360
5461 - name : Set version variables
5562 run : |
56- cd grass
57- eval $(./utils/update_version.py status --bash)
58- echo "MAJOR=$MAJOR" >> $GITHUB_ENV
59- echo "MINOR=$MINOR" >> $GITHUB_ENV
60- echo "VERSION=$VERSION" >> $GITHUB_ENV
61- echo "YEAR=$YEAR" >> $GITHUB_ENV
63+ cd grass || exit
64+ eval "$(./utils/update_version.py status --bash)"
65+ {
66+ echo "MAJOR=${MAJOR}"
67+ echo "MINOR=${MINOR}"
68+ echo "VERSION=${VERSION}"
69+ echo "YEAR=${YEAR}"
70+ } >> "${GITHUB_ENV}"
6271
6372 - name : Checkout addons
6473 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -69,13 +78,14 @@ jobs:
6978 fetch-depth : 0
7079 persist-credentials : false
7180
72- - name : ccache
81+ - name : ccache (do not use for release artifacts)
7382 uses : hendrikmuhs/ccache-action@bfa03e1de4d7f7c3e80ad9109feedd05c4f5a716 # v1.2.19
83+ if : ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
7484 with :
7585 create-symlink : true
7686 verbose : 2
7787 evict-old-files : 7d
78- key : ${{ github.workflow }}-${{ github.job }}-grass${{ env.MAJOR }}-${{ matrix.python-version }}
88+ key : ${{ github.workflow }}-${{ github.job }}-grass${{ env.MAJOR }}-${{ env.PYTHON_VERSION }}
7989
8090 - name : Install Python dependencies
8191 # We install both core and addon dependencies, but we don't install any
8696 pip install -r grass-addons/.github/workflows/requirements.txt
8797
8898 - uses : rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
99+ if : ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
89100
90101 - name : Create installation directory
91102 run : |
@@ -170,11 +181,11 @@ jobs:
170181 - name : Compile addons
171182 run : |
172183 ./grass-addons/utils/cronjobs_osgeo_lxd/compile_addons_git.sh \
173- "$MAJOR" \
174- "$MINOR" \
175- $(pwd)/grass-addons/src \
176- $(grass --config path) \
177- $(pwd)/addons-build-dir \
184+ "${ MAJOR} " \
185+ "${ MINOR} " \
186+ " $(pwd)/grass-addons/src" \
187+ " $(grass --config path)" \
188+ " $(pwd)/addons-build-dir" \
178189 grass
179190
180191 - name : Get target path for Markdown files
@@ -183,24 +194,27 @@ jobs:
183194
184195 - name : Move from build to target directory
185196 run : |
186- mkdir "$MKDOCS_DIR/source/addons"
187- mv -v addons-build-dir/docs/md/source/* "$MKDOCS_DIR/source/addons"
197+ mkdir "${ MKDOCS_DIR} /source/addons"
198+ mv -v addons-build-dir/docs/md/source/* "${ MKDOCS_DIR} /source/addons"
188199
189200 - name : Build index
190201 run : |
191- export ARCH="$(grass --config arch)"
192- export ARCH_DISTDIR="$(grass --config path)"
193- export VERSION_NUMBER="$VERSION"
202+ ARCH="$(grass --config arch)"
203+ ARCH_DISTDIR="$(grass --config path)"
204+ export ARCH
205+ export ARCH_DISTDIR
206+ export VERSION_NUMBER="${VERSION}"
194207 grass --tmp-project XY --exec \
195- python grass/man/build_full_index.py md index "$MKDOCS_DIR/source/addons" addons
208+ python grass/man/build_full_index.py md index "${ MKDOCS_DIR} /source/addons" addons
196209
197210 - name : Copy shared files to addons
198211 run : |
199- cd "$MKDOCS_DIR/source"
212+ cd "${ MKDOCS_DIR} /source" || exit
200213 # This should match directories with color tables and other files
201214 # linked from the pages.
215+ # shellcheck disable=SC2010,SC2035 # TODO: Address these two issues
202216 for name in $(ls -1d */ | grep -vE "^(addons|libpython)/$"); do
203- cp -rv $ name addons
217+ cp -rv "${ name}" addons
204218 done
205219
206220 - name : Get mkdocs
@@ -209,30 +223,30 @@ jobs:
209223
210224 - name : Run mkdocs
211225 run : |
212- cd grass
213- eval $(./utils/update_version.py status --bash)
226+ cd grass || exit
227+ eval " $(./utils/update_version.py status --bash)"
214228 cd ..
215229 export SITE_NAME="GRASS $VERSION Documentation"
216230 export COPYRIGHT="© 2003-$YEAR GRASS Development Team, GRASS $VERSION Documentation"
217- cd $ MKDOCS_DIR
231+ cd "${ MKDOCS_DIR}" || exit
218232 mkdocs build
219233
220234 - name : Build Sphinx documentation
221235 run : |
222236 pip install -r "grass/python/grass/docs/requirements.txt"
223- cd grass
237+ cd grass || exit
224238 make sphinxdoclib
225239 ARCH="$(grass --config arch)"
226- mv -v dist.$ ARCH/docs/html/libpython $ MKDOCS_DIR/site
240+ mv -v dist."${ ARCH} /docs/html/libpython" "${ MKDOCS_DIR} /site"
227241
228242 - name : Merge Sphinx and MkDocs Sitemaps
229243 run : |
230- cd grass
244+ cd grass || exit
231245 python utils/merge_sitemaps.py \
232- --mkdocs-sitemap "$MKDOCS_DIR/site/sitemap.xml" \
233- --sphinx-sitemap "$MKDOCS_DIR/site/libpython/sitemap.xml" \
234- --output "$MKDOCS_DIR/site/sitemap.xml" \
235- --version $ VERSION -o
246+ --mkdocs-sitemap "${ MKDOCS_DIR} /site/sitemap.xml" \
247+ --sphinx-sitemap "${ MKDOCS_DIR} /site/libpython/sitemap.xml" \
248+ --output "${ MKDOCS_DIR} /site/sitemap.xml" \
249+ --version "${ VERSION}" -o
236250
237251 - name : Make logs available
238252 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
0 commit comments