Commit c9343f77 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Remove existing pdf files and do not produce pdf files in future tags

parent 99b1bf8c
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -20,11 +20,14 @@ Validate OpenAPIs:
  stage: validation
  script:
    - echo 'Validate OpenAPIs'
    - docker run -v "$(pwd)":/work -u $(id -u):$(id -g) openapivalidator "/work" "/storage" "$filter"
    - docker run --rm -v "$(pwd)":/work -u $(id -u):$(id -g) openapivalidator "/work" "/storage" "$filter"
  artifacts:
    when: on_success
    paths:
      - build/*
  rules:
    - if: $CLEAN_WEB_PAGES == "false"
      when: always
    
pages:
  stage: publish
@@ -37,13 +40,25 @@ pages:
    - if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
    - set -e
    # Add/update content
    - mkdir -p "public/$CI_COMMIT_REF_NAME"
    - cp -r -f build/* public/$CI_COMMIT_REF_NAME
    - if [[ -n "$CI_COMMIT_TAG" ]]; then mkdir -p "public/$CI_COMMIT_TAG"; cp -r -f build/* public/$CI_COMMIT_TAG; fi
    - if [ "$CLEAN_WEB_PAGES" != "false" ]; then echo "Removing folder $CLEAN_WEB_PAGES..."; rm -r public/$CLEAN_WEB_PAGES; fi
    # Remove all pdf files
    - rm -f public/*/*.pdf
    # Zip the content and publish the zip again
    - zip -r "content.zip" "public"
    - mv "content.zip" "public/"
    - du -h public/
  artifacts:
    paths:
      - public
  only:
    - tags  
 No newline at end of file
  rules:
    # Job executed when creating a tag
    - if: $CI_COMMIT_TAG
      when: always
    # Job executed when creating an official tag (in case needed)
    #- if: $CI_COMMIT_TAG =~ /v\d(\.\d){2}$/
    #  when: always
    # Job executed when CLEAN_WEB_PAGES is not false, to remove obsolete/unnecessary tags
    - if: $CLEAN_WEB_PAGES != "false"
      when: always
    
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -27,9 +27,9 @@ function validate_api () {
  yaml2json "${merged_file}" > "${json_file}"
  
  # Create the PDF version
  echo "--- Create PDF..."
  oas2pdf "${json_file}" 2>/dev/null 1>/dev/null 
  mv "${deliverable}-${api}-API.pdf" "../build/"
  #echo "--- Create PDF..."
  #oas2pdf "${json_file}" 2>/dev/null 1>/dev/null 
  #mv "${deliverable}-${api}-API.pdf" "../build/"

  echo "--- Validating ${merged_file}"
  swagger-cli validate "${merged_file}"
@@ -39,7 +39,7 @@ function validate_api () {
  # If validation succedes, store the generated file
  [ $vres -a -d "/storage" ] && store_api "${merged_file}"
  [ $vres -a -d "/storage" ] && store_api "${json_file}"
  [ $vres -a -d "/storage" ] && store_api "../build/${deliverable}-${api}-API.pdf"
  #[ $vres -a -d "/storage" ] && store_api "../build/${deliverable}-${api}-API.pdf"
  
  
  return $vres