From 2cbf527e55dd9622be7caf3d115b164be573e827 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Wed, 14 Sep 2022 23:50:04 +0100 Subject: [PATCH] Fix deploying new docs to old stable tag (#1598) * Fix deploying new docs to old stable tag Previously, we relied on inferring the tag from `git describe`. This has been somewhat unreliable in the past, seemingly not recognising the newest tag when triggered. It is possible that the VM's git checkout is initialised before the tag is synced into the main repo, which might have caused this. Instead, we extract the tag from the environment variable GitHub Actions sets to pass to the deployment script directly. This is guaranteed to give the correct tag. * Force use of bash --- .github/workflows/docs_tag.yml | 3 ++- tools/deploy_documentation_tag.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs_tag.yml b/.github/workflows/docs_tag.yml index 7d9b20aa81a4..69a6f5cd1539 100644 --- a/.github/workflows/docs_tag.yml +++ b/.github/workflows/docs_tag.yml @@ -25,5 +25,6 @@ jobs: encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }} encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }} QISKIT_DOCS_BUILD_TUTORIALS: 'always' + shell: bash run: | - tools/deploy_documentation_tag.sh + tools/deploy_documentation_tag.sh ${GITHUB_REF#refs/tags/} diff --git a/tools/deploy_documentation_tag.sh b/tools/deploy_documentation_tag.sh index b535af24574c..7b5bb504249c 100755 --- a/tools/deploy_documentation_tag.sh +++ b/tools/deploy_documentation_tag.sh @@ -15,6 +15,10 @@ # Script for pushing the stable documentation. set -e +if [ $# -ne 1 ]; then + echo "Usage: $(basename "$0") " >&2 && exit 1 +fi + curl https://downloads.rclone.org/rclone-current-linux-amd64.deb -o rclone.deb sudo apt-get install -y ./rclone.deb @@ -22,10 +26,11 @@ RCLONE_CONFIG_PATH=$(rclone config file | tail -1) echo "show current dir: " pwd - -CURRENT_TAG=`git describe --abbrev=0` +CURRENT_TAG=$1 +echo "Got tag $CURRENT_TAG" IFS=. read -ra VERSION <<< "$CURRENT_TAG" STABLE_VERSION="${VERSION[0]}.${VERSION[1]}" +echo "Building for stable version $STABLE_VERSION" # Build the documentation. tox -edocs -- -D content_prefix=documentation/stable/"$STABLE_VERSION" -j auto