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 Original line Diff line number Diff line
@@ -20,11 +20,14 @@ Validate OpenAPIs:
  stage: validation
  stage: validation
  script:
  script:
    - echo 'Validate OpenAPIs'
    - 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:
  artifacts:
    when: on_success
    when: on_success
    paths:
    paths:
      - build/*
      - build/*
  rules:
    - if: $CLEAN_WEB_PAGES == "false"
      when: always
    
    
pages:
pages:
  stage: publish
  stage: publish
@@ -37,13 +40,25 @@ pages:
    - if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
    - if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
    - set -e
    - set -e
    # Add/update content
    # Add/update content
    - mkdir -p "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
    - cp -r -f build/* public/$CI_COMMIT_REF_NAME
    - 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 the content and publish the zip again
    - zip -r "content.zip" "public"
    - zip -r "content.zip" "public"
    - mv "content.zip" "public/"
    - mv "content.zip" "public/"
    - du -h public/
  artifacts:
  artifacts:
    paths:
    paths:
      - public
      - public
  only:
  rules:
    - tags  
    # Job executed when creating a tag
 No newline at end of file
    - 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 Original line Diff line number Diff line
@@ -27,9 +27,9 @@ function validate_api () {
  yaml2json "${merged_file}" > "${json_file}"
  yaml2json "${merged_file}" > "${json_file}"
  
  
  # Create the PDF version
  # Create the PDF version
  echo "--- Create PDF..."
  #echo "--- Create PDF..."
  oas2pdf "${json_file}" 2>/dev/null 1>/dev/null 
  #oas2pdf "${json_file}" 2>/dev/null 1>/dev/null 
  mv "${deliverable}-${api}-API.pdf" "../build/"
  #mv "${deliverable}-${api}-API.pdf" "../build/"


  echo "--- Validating ${merged_file}"
  echo "--- Validating ${merged_file}"
  swagger-cli validate "${merged_file}"
  swagger-cli validate "${merged_file}"
@@ -39,7 +39,7 @@ function validate_api () {
  # If validation succedes, store the generated file
  # If validation succedes, store the generated file
  [ $vres -a -d "/storage" ] && store_api "${merged_file}"
  [ $vres -a -d "/storage" ] && store_api "${merged_file}"
  [ $vres -a -d "/storage" ] && store_api "${json_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
  return $vres