stages:
    - build

variables:
    VERSION: ""

before_script:
    - export VERSION=$(cat version)
    - mkdir -p releases/DoLP_Vanilla/img/
    - mkdir -p releases/DoLP_BEEESSS/img/
    - mkdir -p releases/DoLP_BEEESSS+Hikari_Female/img/
    - mkdir -p releases/DoLP_BEEESSS+Hikari_Male/img/
    - mkdir -p releases/DoLP_BEEESSS+Paril+Hairstyle_Extended/img/

build:
    stage: build
    script:
    - echo "Building version $VERSION"
    - sh ./compile.sh
    - cp "Degrees of Lewdity.html" ./releases/DoLP_Vanilla/
    - cp -r ./vanillaimg/* ./releases/DoLP_Vanilla/img/
    - cp -r ./vanillaimg/* ./releases/DoLP_BEEESSS/img/
    - cp -r ./vanillaimg/* ./releases/DoLP_BEEESSS+Hikari_Female/img/
    - cp -r ./vanillaimg/* ./releases/DoLP_BEEESSS+Hikari_Male/img/
    - cp -r ./vanillaimg/* ./releases/DoLP_BEEESSS+Paril+Hairstyle_Extended/img/
    - cp "Degrees of Lewdity.html" ./releases/DoLP_BEEESSS/
    - cp -r ./beeesssimg/* ./releases/DoLP_BEEESSS/img/
    - cp -r ./beeesssimg/* ./releases/DoLP_BEEESSS+Hikari_Female/img/
    - cp -r ./beeesssimg/* ./releases/DoLP_BEEESSS+Hikari_Male/img/
    - cp -r ./beeesssimg/* ./releases/DoLP_BEEESSS+Paril+Hairstyle_Extended/img/
    - cp "Degrees of Lewdity.html" ./releases/DoLP_BEEESSS+Hikari_Female/
    - cp -r ./beeessshikarifemaleimg/* ./releases/DoLP_BEEESSS+Hikari_Female/img/
    - cp "Degrees of Lewdity.html" ./releases/DoLP_BEEESSS+Hikari_Male/
    - cp -r ./beeessshikarimaleimg/* ./releases/DoLP_BEEESSS+Hikari_Male/img/
    - cp "Degrees of Lewdity.html" ./releases/DoLP_BEEESSS+Paril+Hairstyle_Extended/
    - cp -r ./beeesssparilhairstyleextendedimg/* ./releases/DoLP_BEEESSS+Paril+Hairstyle_Extended/img/
  
    artifacts:
        paths:
            - releases/

after_script:
    - echo "Finished building."

release:
    stage: build
    script:
        - echo "Creating release ZIP files..."
        - cd releases
        - zip -r "DoLP_Vanilla_${VERSION}.zip" ./DoLP_Vanilla
        - zip -r "DoLP_BEEESSS_${VERSION}.zip" ./DoLP_BEEESSS
        - zip -r "DoLP_BEEESSS+Hikari_Female_${VERSION}.zip" ./DoLP_BEEESSS+Hikari_Female
        - zip -r "DoLP_BEEESSS+Hikari_Male_${VERSION}.zip" ./DoLP_BEEESSS+Hikari_Male
        - zip -r "DoLP_BEEESSS+Paril+Hairstyle_Extended_${VERSION}.zip" ./DoLP_BEEESSS+Paril+Hairstyle_Extended
    artifacts:
        paths:
            - releases/*.zip
    only:
        - master