Skip to content
Snippets Groups Projects
Commit 7efde373 authored by Mathias Goebel's avatar Mathias Goebel :reminder_ribbon:
Browse files

Merge branch 'feature/add-collation-results' into 'develop'

Feature/add collation results

See merge request !101
parents 89a17f92 87358f92
No related branches found
No related tags found
1 merge request!101Feature/add collation results
Pipeline #227328 passed
......@@ -9,18 +9,19 @@ PROJECT_ID=${CI_PROJECT_ID}
ACTIVE_BRANCHES=$(curl --header "PRIVATE-TOKEN: $API_TOKEN" "https://gitlab.gwdg.de/api/v4/projects/${PROJECT_ID}/repository/branches" | jq -r '.[].name')
# the variable CI_COMMIT_REF_SLUG we use for naming the directories in 'public' escapes
# all non-alpanumeric characters to '-'. This has to be considered for comparing the
# directry names with the branch names.
ACTIVE_BRANCHES=$(echo $ACTIVE_BRANCHES | sed -E "s/[^0-9a-z[:space:]]/-/g")
# directory names with the branch names.
echo $ACTIVE_BRANCHES
echo $ACTIVE_BRANCHES | sed "s [^0-9a-zA-Z[:space:]] - g" | sed "s [[:space:]] \n g" > /tmp/branches
echo "compare to:"
cat /tmp/branches
cd public
for ENTRY in *
do
# preserve content of main branch
if [[ ${ENTRY} = "main" ]]; then
:
# remove other entries that are no longer active
elif [[ ! $ACTIVE_BRANCHES =~ $ENTRY ]]; then
rm -r $ENTRY
fi
done
ls > /tmp/list
for DIR in $(grep -Fxv -f /tmp/branches /tmp/list); do
echo "removing $DIR"
rm -rf $DIR
done
cp --recursive main/* .
......@@ -13,15 +13,15 @@ LATEST_JOB_ID=$(echo $JOBS | jq '.[] | select(.stage == "pages").id' | sed -n 1p
curl --output old-artifact.zip --header "PRIVATE-TOKEN: $API_TOKEN" "https://gitlab.gwdg.de/api/v4/projects/${CI_PROJECT_ID}/jobs/${LATEST_JOB_ID}/artifacts"
# add current data to artifact
unzip -u old-artifact.zip
unzip -u -qq old-artifact.zip
# we want the main branch to be available at https://subugoe.pages.gwdg.de/ahiqar/website/ while
# the environments of the feature branches should be available at
# https://subugoe.pages.gwdg.de/ahiqar/website/${CI_COMMIT_REF_SLUG}/.
# this has to be considered in the directory structure.
if [[ ${CI_COMMIT_REF_SLUG} == "main" ]]; then
cp --recursive public/main/* public/
fi
#if [[ ${CI_COMMIT_REF_SLUG} == "main" ]]; then
# cp --recursive public/main/* public/
#fi
# [ $? -eq 0 ] && exit 0
......@@ -28,11 +28,22 @@ Images and files can be added too, a description on how to do that is not necess
## Content via API
Some pages are prepared form TEI source files. HTML is provided via backend.
### Manuscripts
To update the [list of manuscripts](src/manuscripts.md), run the following code.
```bash
head -$(grep " HTML " src/manuscripts.md -n | cut -f1 -d:) src/manuscripts.md >> src/tmp.md
echo "" >> src/tmp.md # newline
curl https://ahikar-test.sub.uni-goettingen.de/api/website/manuscripts | sed "s#xhtml:##g" >> src/tmp.md
curl https://ahikar-dev.sub.uni-goettingen.de/api/website/manuscripts | sed "s#xhtml:##g" >> src/tmp.md
# check result at tmp.md and than
mv src/tmp.md src/manuscripts.md
```
### Collation Results
To update the [collation results](src/collation.md), run the following code.
```bash
head -$(grep " HTML " src/collation.md -n | cut -f1 -d:) src/collation.md >> src/tmp.md
echo "" >> src/tmp.md # newline
curl https://ahikar-dev.sub.uni-goettingen.de/api/website/collation | sed "s#xhtml:##g" >> src/tmp.md
# check result at tmp.md and than
mv src/tmp.md src/collation.md
```
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment