Skip to content
Snippets Groups Projects
Commit 7d39a5b3 authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

update .gitlab-ci.yml

parent 45fadf38
No related branches found
No related tags found
No related merge requests found
Pipeline #231630 passed
...@@ -12,39 +12,42 @@ pages: ...@@ -12,39 +12,42 @@ pages:
# Define a function to download artifacts based on a given URL # Define a function to download artifacts based on a given URL
download_artifacts() { download_artifacts() {
local url=$1 local url=$1
local dir=$2 local branch=$2
local http_status=$(curl -k -o /dev/null -s -w "%{http_code}" "$url") local http_status=$(curl -k -o /dev/null -s -w "%{http_code}" "$url")
if [[ "$http_status" =~ ^2 ]]; then if [[ "$http_status" =~ ^2 ]]; then
echo "HTTP $http_status OK. Downloading artifacts from $url..." echo "HTTP $http_status OK. Downloading artifacts from $url..."
curl -o artifacts.zip "$url" curl -o artifacts.zip "$url"
mkdir -p "$dir" mkdir -p tmp
unzip -o artifacts.zip -d "$dir" if unzip -o artifacts.zip -d tmp; then
test -d tmp/public/${branch} && mv tmp/public/${branch} public/${branch}
else
echo "Failed to unzip artifacts.zip for branch ${branch}"
fi
# This artifact contains all branches, but we're only interested in one
rm artifacts.zip rm artifacts.zip
rm -rf tmp
else else
echo "No artifacts found or failed to download from $url. HTTP Status Code: $http_status" echo "No artifacts found or failed to download from $url. HTTP Status Code: $http_status"
fi fi
} }
mkdir -p public
# Loop through each branch and download artifacts # Loop through each branch and download artifacts
for branch in $BRANCHES; do for branch in $BRANCHES; do
# Skip download if branch is the current commit branch
if [[ "$branch" == "$CI_COMMIT_REF_NAME" ]]; then
echo "Skipping artifact download for current branch: $branch"
continue
fi
artifact_url="${ARTIFACT_URL_PREFIX}/${branch}/${ARTIFACT_URL_SUFFIX}" artifact_url="${ARTIFACT_URL_PREFIX}/${branch}/${ARTIFACT_URL_SUFFIX}"
download_artifacts "$artifact_url" "./public/$branch" download_artifacts "$artifact_url" "$branch"
done done
- pip install -r requirements.txt - pip install -r requirements.txt
- echo "Previous content of public directory"
- ls public
- echo "ls juniq"
- ls public/juniq
- echo "ls jupyterjsc"
- ls public/jupyterjsc
- mkdocs build -d tmp
- ls tmp
- rm -rf public/${CI_COMMIT_REF_NAME} - rm -rf public/${CI_COMMIT_REF_NAME}
- mkdocs build -d tmp
- mv tmp public/${CI_COMMIT_REF_NAME} - mv tmp public/${CI_COMMIT_REF_NAME}
- echo "Post-build content of public directory"
- ls public
artifacts: artifacts:
paths: paths:
- public - public
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment