From 3021048b779cb94dfe2f4422ea412d59d2eeb7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Mon, 5 Oct 2020 07:50:30 +0000 Subject: [PATCH 1/3] The stable book should build from branch --- .github/workflows/build.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c687115389..e6271c852f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -594,27 +594,30 @@ jobs: - name: Build books run: | langs=( en ru ) - latest=0.5 - vers=( 0.4.x ) + devver=dev + stable=$(git tag | grep v | tail -n 1 | cut -c2-4) + vers=( 0.5.x 0.4.x ) # Create directories td=$(mktemp -d) - mkdir -p $td/$latest/book/ - cp -r target/doc $td/$latest/api + mkdir -p $td/$devver/book/ + cp -r target/doc $td/$devver/api - # sed fixes - sed 's|URL|rtic/index.html|g' redirect.html > $td/$latest/api/index.html - sed 's|URL|0.5|g' redirect.html > $td/index.html - sed 's|URL|book/en|g' redirect.html > $td/$latest/index.html + # Redirect the main site to the stable release + sed "s|URL|$stable|g" redirect.html > $td/index.html + + # Create the redirects for dev-version + sed 's|URL|rtic/index.html|g' redirect.html > $td/$devver/api/index.html + sed 's|URL|book/en|g' redirect.html > $td/$devver/index.html # Build books for lang in ${langs[@]}; do ( cd book/$lang && mdbook build ) - cp -r book/$lang/book $td/$latest/book/$lang - cp LICENSE-* $td/$latest/book/$lang/ + cp -r book/$lang/book $td/$devver/book/$lang + cp LICENSE-* $td/$devver/book/$lang/ done - # Build older versions + # Build older versions, including stable root=$(pwd) for ver in ${vers[@]}; do prefix=${ver%.*} @@ -639,6 +642,9 @@ jobs: rm -rf $src done + # Create alias for the stable release + ln -s $td/$stable $td/stable + # Forward CNAME file cp CNAME $td/ mv $td/ bookstodeploy From 2f3dafe711912fbb45c14419cf410250a69f3b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Mon, 5 Oct 2020 07:56:53 +0000 Subject: [PATCH 2/3] Ensure pre-releases are not included --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6271c852f..22f13fa2e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -595,7 +595,7 @@ jobs: run: | langs=( en ru ) devver=dev - stable=$(git tag | grep v | tail -n 1 | cut -c2-4) + stable=$(git tag | grep v | grep -v "-" | tail -n 1 | cut -c2-4) vers=( 0.5.x 0.4.x ) # Create directories From 03bff3dd808d1d75b774953a2c9804905029e7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Mon, 5 Oct 2020 08:09:43 +0000 Subject: [PATCH 3/3] v must be first in the tag, document the version --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22f13fa2e1..0fb146499d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -595,7 +595,11 @@ jobs: run: | langs=( en ru ) devver=dev - stable=$(git tag | grep v | grep -v "-" | tail -n 1 | cut -c2-4) + # Query git for tagged releases, all releases start with "v" + # followed by MAJOR.MINOR.PATCH, see semver.org + # Then remove all pre-releases/tags with hyphens (-). + # The latest release is last, finally trim "v" and PATCH + stable=$(git tag | grep "^v" | grep -v "-" | tail -n 1 | cut -c2-4) vers=( 0.5.x 0.4.x ) # Create directories