diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2711077..7659851 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,11 +2,16 @@ variables: INSTANCE: 'Writerside/in' ARTIFACT: 'webHelpIN2-all.zip' DOCKER_VERSION: '241.16003' + ALGOLIA_APP_NAME: 'IH6YW1953U' + ALGOLIA_INDEX_NAME: 'ZUSAMMENFASSUNGEN' + CONFIG_JSON_PRODUCT: 'IN' + CONFIG_JSON_VERSION: '1.0' stages: - build - test - deploy + - search build: stage: build @@ -47,4 +52,34 @@ pages: artifacts: paths: - public + expire_in: 1 week + + +search: + stage: search + image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-3 + dependencies: + - build + - test + - pages + script: + - echo "Checking contents of the public directory..." + - ls -la public + - if [ -z "$ALGOLIA_KEY" ]; then + echo "ALGOLIA_KEY is not set in Gitlab secrets"; + exit 1; + fi + - echo "ALGOLIA_KEY is set" + - PROJECT_ID=$(echo $INSTANCE | cut -d'/' -f2 | tr '[:lower:]' '[:upper:]') + - ALGOLIA_ARTIFACT="algolia-indexes-${PROJECT_ID}.zip" + - echo "ALGOLIA_ARTIFACT is $ALGOLIA_ARTIFACT" + - if [ ! -f "public/$ALGOLIA_ARTIFACT" ]; then + echo "Artifacts file public/$ALGOLIA_ARTIFACT not found!"; + exit 1; + fi + - unzip -O UTF-8 public/$ALGOLIA_ARTIFACT -d algolia-indexes + - env "algolia-key=$ALGOLIA_KEY" java -jar /opt/builder/help-publication-agent.jar update-index --application-name $ALGOLIA_APP_NAME --index-name $ALGOLIA_INDEX_NAME --product $CONFIG_JSON_PRODUCT --version $CONFIG_JSON_VERSION --index-directory algolia-indexes/ 2>&1 | tee algolia-update-index-log.txt + artifacts: + paths: + - algolia-update-index-log.txt expire_in: 1 week \ No newline at end of file