Commit 92b9b75c authored by Marco Cavalli's avatar Marco Cavalli
Browse files

fix: streamline publication script and improve error handling for template file

parent 1160e574
Loading
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -16,17 +16,11 @@ variables:

Publish spec:
  stage: publication
  rules:
    - if: $CI_COMMIT_TAG
  only:
    - tags
  before_script:
    - chmod +x .gitlab/generateCR/publish_spec.sh
    - docker pull "${IMAGE_NAME}"
    - |
      if [[ ! -f "customized_reference.docx" ]]; then
        curl --fail --location --silent --show-error \
          "${CI_API_V4_URL}/projects/$PIPELINE_SCRIPTS_PROJECT_ID/repository/files/specifications%2FSpec-template%2Edocx/raw?ref=main" \
          -o customized_reference.docx
      fi
    - export SPEC_NAME="$(ls | grep -E "(GS|GR|TS).*\.md" | head -n1 | cut -d'.' -f1 || true)"
  script:
    - echo 'Publishing spec with local repository script'
+3 −6
Original line number Diff line number Diff line
@@ -70,12 +70,7 @@ if ! docker image inspect "$IMAGE_NAME" >/dev/null 2>&1 || [[ "$REBUILD" == "tru
fi

if [[ -n "$TEMPLATE_DOCX_ARG" ]]; then
  echo "Info: template_docx argument is ignored. Using customized_reference.docx from repository."
fi

if [[ ! -f "customized_reference.docx" ]]; then
  echo "Error: customized_reference.docx not found in repository root"
  exit 1
  echo "Info: template_docx argument is ignored. Using customized_reference.docx when available."
fi

mkdir -p GENERATED_FILES baseline
@@ -83,6 +78,8 @@ mkdir -p GENERATED_FILES baseline
TEMPLATE_MOUNT=""
if [[ -f "customized_reference.docx" ]]; then
  TEMPLATE_MOUNT="$(pwd)/customized_reference.docx:/app/customized_reference.docx:ro"
else
  echo "Warning: customized_reference.docx not found, running with container default template"
fi

TEMPLATE_ARGS=()