Skip to content

Commit

Permalink
Use jq to get latest version of react app for zip download
Browse files Browse the repository at this point in the history
  • Loading branch information
dgading committed Dec 7, 2023
1 parent 595b8a9 commit 58d1db3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions commands/web/dkan-frontend-install
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

# TODO: Make a CI flag.

FRONTEND_TMP='src/tmp'
FRONTEND_DOCROOT_DIR='docroot/frontend'
FRONTEND_VCS_URL='https://github.com/GetDKAN/data-catalog-app/'



if [[ -L $FRONTEND_DOCROOT_DIR ]]; then
echo "ERROR: Symlink $FRONTEND_DOCROOT_DIR already exists."
exit 1
Expand All @@ -27,17 +30,16 @@ if [ ! -z "$DKAN_MODULE_PATH" ]; then
fi
fi

echo " ** Gathering frontend application: $FRONTEND_VCS_URL"
echo " ** Finding latest tag for $FRONTEND_VCS_URL"

git clone "$FRONTEND_VCS_URL".git docroot/data-catalog-app
git -C docroot/data-catalog-app fetch --tags
tag=$(git -C docroot/data-catalog-app describe --tags `git -C docroot/data-catalog-app rev-list --tags --max-count=1`)
FRONTEND_VCS_REF=$(curl -s https://api.github.com/repos/getdkan/data-catalog-app/releases/latest | jq -r '.tag_name')

echo " ** Switching to latest tag: $tag"
echo " ** Gathering frontend application: $FRONTEND_VCS_REF from $FRONTEND_VCS_URL"

git -C docroot/data-catalog-app checkout $tag -b latest
mv docroot/data-catalog-app "$FRONTEND_DOCROOT_DIR"
rm -rf "$FRONTEND_DOCROOT_DIR"/.git
mkdir -p $FRONTEND_TMP
wget -O $FRONTEND_TMP/data-catalog-app-$FRONTEND_VCS_REF.zip "$FRONTEND_VCS_URL"/archive/"$FRONTEND_VCS_REF".zip
unzip $FRONTEND_TMP/data-catalog-app-$FRONTEND_VCS_REF.zip -d docroot/
mv docroot/data-catalog-app-$FRONTEND_VCS_REF "$FRONTEND_DOCROOT_DIR"

cd $FRONTEND_DOCROOT_DIR || exit
# Don't fill the screen with warnings, only errors.
Expand Down

0 comments on commit 58d1db3

Please sign in to comment.