Commit 2e875d30 authored by mrodzis's avatar mrodzis 🐸
Browse files

Merge branch 'bugfix/#202-ci-fix-artifact-size' into 'develop'

Bugfix/#202 ci fix artifact size

Closes #202

See merge request subugoe/emo/Qviewer!133
parents 80460e29 5c417689
Pipeline #188080 passed with stages
in 2 minutes and 34 seconds
......@@ -15,22 +15,33 @@
# get current date in seconds–standard procedure for comparing two dates
current_date=$(date "+%Y%m%d")
current_date_in_s=$(date -d $current_date "+%s")
current_date_in_s=$(date -d "$current_date" "+%s")
cd public
cd public || exit
for entry in *
do
last_modified=$(date -r $entry "+%Y%m%d")
last_modified_in_s=$(date -d $last_modified +%s)
last_modified=$(date -r "$entry" "+%Y%m%d")
last_modified_in_s=$(date -d "$last_modified" +%s)
# difference in days
diff=$((($current_date_in_s - $last_modified_in_s) / (24*3600)))
# preserve content of development branch ...
diff=$(((current_date_in_s - last_modified_in_s) / (24*3600)))
# preserve content of development branch except data that doesn't belong here...
if [[ ${entry} = "develop" ]]; then
:
cd develop || exit
GLOBIGNORE="*.js:*.html"
rm -rf -- *
unset GLOBIGNORE
cd ..
# ... remove other entries that are older than 2 weeks ...
elif [[ $diff -gt 14 ]]; then
rm -r $entry
rm -r "$entry"
# ... clean up other entries ...
else
cd "$entry" || exit
GLOBIGNORE="*.js:*.html"
rm -rf -- *
unset GLOBIGNORE
cd ..
## ... keep the single commit entries ...
#elif [[ ${#entry} == 8 && ${entry} =~ [a-z0-9] ]]; then
# :
......@@ -38,4 +49,4 @@ for entry in *
#elif [[ ! ${active_branches[@]} =~ ${entry} ]]; then
# rm -r $entry
fi
done
done
\ No newline at end of file
......@@ -7,6 +7,13 @@ stages:
- deploy
- preserve-pages
# Templates
.build: &build
- bash .ci-scripts/set_entrypoint_ci.sh
- npm install
- npm run build
- npm run tweak:build
build_test:
image: docker.gitlab.gwdg.de/subugoe/emo/qviewer/node:latest
except:
......@@ -14,10 +21,7 @@ build_test:
- develop
stage: build
script:
- ./set_entrypoint_ci.sh
- npm install
- npm run build
- npm run tweak:build
- *build
artifacts:
paths:
- dist/
......@@ -29,14 +33,11 @@ build_main_and_develop:
- develop
stage: build
script:
- ./set_entrypoint_ci.sh
- npm install
- npm run build
- npm run tweak:build
- *build
artifacts:
paths:
- dist/
expire_in: never
expire_in: 1 mos
update-ahikar:
stage: deploy
......@@ -48,11 +49,7 @@ update-ahikar:
trigger: "subugoe/ahiqar/ahiqar-tido"
pages:
before_script:
- dnf install -y jq
- dnf install -y zip
- dnf install -y unzip
image: docker.gitlab.gwdg.de/mgoebel/swiss_knife/fedora:latest
image: docker.gitlab.gwdg.de/mrodzis/docker-images/debian
# at the very early stage lets deploy for every branch
# only:
# - main
......@@ -64,8 +61,8 @@ pages:
- public
when: always
script:
- bash update-artifacts.sh
- bash gitlab-remove-old-artifacts.sh
- bash .ci-scripts/update-artifacts.sh
- bash .ci-scripts/gitlab-remove-old-artifacts.sh
environment:
name: ${CI_COMMIT_REF_SLUG}
url: https://subugoe.pages.gwdg.de/emo/Qviewer/${CI_COMMIT_REF_SLUG}/
......
......@@ -30,7 +30,7 @@ done
rm "${FILES[@]}"
# print the result
tree $DIST_DIR
ls $DIST_DIR
# replace the included js files from the former build by the single one concatenated above
sed -ri 's:<script\s+src.*</script>:<script src="'${PROD_NAME}'.js"></script>:' ${DIST_DIR}/index.html
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment