From 16d698a4575d487b3783162ddf27903f9e140917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Wed, 11 Jan 2023 16:22:58 +0100 Subject: [PATCH] fix: (too) early modification of application version in Angular service worker configuration file refs #588 --- scripts/deploy-new-stable-version.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/deploy-new-stable-version.sh b/scripts/deploy-new-stable-version.sh index 92733055e..14ae97da1 100755 --- a/scripts/deploy-new-stable-version.sh +++ b/scripts/deploy-new-stable-version.sh @@ -19,6 +19,9 @@ then exit 1 fi +# Angular service worker configuration file +NGSW_CONF=ngsw-config.json + # 0. changelog read -p "Avez-vous rempli jalhyd_branch, et les CHANGELOG de JaLHyd et NgHyd pour la version $VERSION ? (o/N) " -n 1 -r echo @@ -28,8 +31,8 @@ then exit 2 fi -if [[ ! -f ngsw-config.json ]]; then - echo "Fichier de configuration du service worker ngsw-config.json non trouvé" >&2 +if [[ ! -f $NGSW_CONF ]]; then + echo "Fichier de configuration du service worker $NGSW_CONF non trouvé" >&2 exit 1 fi @@ -73,11 +76,7 @@ git push --tags --force echo "BUILDING NGHYD" cd .. -# 2.1 service worker configuration (application version) - -sed -i "/\"version\": \"/s/\": \".*/\": \"$VERSION\"/" ngsw-config.json - -# 2.2 update Git repository +# 2.1 update Git repository git checkout master git pull --rebase npm install @@ -87,7 +86,7 @@ then git commit -a -m "verify dependencies (npm install) before deploying version $VERSION" fi -# 2.3 version in package.* +# 2.2 version in package.* npm version "$VERSION" --allow-same-version --git-tag-version=false if [ ! -z "$(git status --untracked-files=no --porcelain)" ] then @@ -95,6 +94,15 @@ then git commit -a -m "update package.* to version $VERSION" fi +# 2.3 service worker configuration (application version) +echo "updating version in Angular service worker configuration" >&2 +sed -i "/\"version\": \"/s/\": \".*/\": \"$VERSION\"/" $NGSW_CONF +# check +if [[ -z $(grep version $NGSW_CONF | grep $VERSION) ]]; then + echo "error updating version in service worker configuration file $NGSW_CONF" >&2 + exit 1 +fi + # 2.4 tags echo "setting tags to $VERSION version" git tag -fa stable -m "stable version" -- GitLab