Skip to content

Commit 2844d30

Browse files
committed
fix api version by changing the command to get latest release tag
1 parent 0eb281d commit 2844d30

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/mdbook-github-pages.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,26 @@ jobs:
5555
rm -rf 'src/docs/https:'
5656
# API docs
5757
cd build
58-
export FP_GH=https://github.com/freeplane/freeplane
59-
# Change TAG_PATTERN when a new major version is released
60-
export TAG_PATTERN=release-1.12.*
61-
while read -r hash ref; do if [[ $ref != *-pre* ]]; then latest_stable_release_tag=${ref##*/}; fi; done < <(git ls-remote --tags $FP_GH $TAG_PATTERN)
58+
FP_GH=https://github.com/freeplane/freeplane
59+
TAG_PATTERN=release-1.*
60+
latest_stable_release_ref=$(git ls-remote --tags $FP_GH $TAG_PATTERN | awk '!/-pre[0-9]+$/ {print $2}' | sort -V | tail -1)
61+
latest_stable_release_tag=${latest_stable_release_ref#refs/tags/}
6262
_tag=$(curl https://docs.freeplane.org/api/_tag.txt)
63+
echo "Start building API docs - online-api/_tag: $_tag, Freeplane-repo/latest_stable_release_tag: $latest_stable_release_tag"
6364
if [[ $_tag && $_tag = $latest_stable_release_tag ]]; then
64-
# It's the same release tag as the API docs saved in GitHub Pages - use this one instead of going to SourceForge
65+
echo "It's the same release tag as the API docs saved in GitHub Pages - use this one instead of going to SourceForge"
6566
download_and_unpack_api_zip
6667
else
6768
version=${latest_stable_release_tag#release-}
68-
# Try to download freeplane-bin-$version.zip from SF and to extract doc/api/ pages
69+
echo "Try to download freeplane-bin-$version.zip from SF and to extract doc/api/ pages"
6970
[[ $version ]] &&
7071
curl -L https://sourceforge.net/projects/freeplane/files/freeplane%20stable/freeplane_bin-${version}.zip/download -o freeplane-bin.zip &&
7172
unzip freeplane-bin.zip "freeplane-${version}/doc/api/*" &&
7273
mv -v "freeplane-${version}/doc/api" gh-pages/ &&
7374
echo "$latest_stable_release_tag" > gh-pages/api/_tag.txt &&
7475
cd gh-pages &&
75-
zip -r api.zip api/ || # Something went wrong - fall back to the last-successfully-downloaded-from-SF api docs
76+
zip -r api.zip api/ ||
77+
echo "Something went wrong - fall back to the last-successfully-downloaded-from-SF api docs" &&
7678
download_and_unpack_api_zip
7779
fi
7880

0 commit comments

Comments
 (0)