1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-05 08:17:04 +00:00

scripts/update-gh-pages: only update docs if version has been released

Only update documentation if the version has been released (i.e. a git
tag corresponding the version we're updating exists) or it is for the
master branch. Prevents us from pointing users to documentation of an
unreleased version.

Also updates github workflow to fetch full commit history (including
tags) so that git describe works correctly.
This commit is contained in:
Markus Lehtonen 2020-12-03 11:10:22 +02:00
parent 42d3fa19ef
commit ad042f92f5
2 changed files with 16 additions and 0 deletions

View file

@ -14,6 +14,8 @@ jobs:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch gh-pages branch
run: git fetch --no-tags --prune --depth=1 origin refs/heads/gh-pages:refs/heads/gh-pages

View file

@ -100,6 +100,20 @@ fi
# Default to 'master' if no subdir was given and we couldn't parse
# it
site_subdir=${site_subdir:-master}
# Check if this ref is for a released version
if [ "$site_subdir" != "master" ]; then
_base_tag=`git describe --abbrev=0 || :`
case "$_base_tag" in
$site_subdir*)
;;
*)
echo "Not a released version. Parsed release branch is $site_subdir but based on tag $_base_tag. Stopping here."
exit 0
;;
esac
fi
echo "Updating site subdir: '$site_subdir'"
export SITE_DESTDIR="_site/$site_subdir"