# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches:
      - master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build_and_deploy:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '12'

      - name: Zip boards folder
        run: cd boards && zip -r ../boards.zip *

      - name: Upload boards
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@boards.zip" "${{ secrets.UPLOAD_BOARDS_URL }}"


      - name: Zip colors folder
        run: cd colors && zip -r ../colors.zip *

      - name: Upload colors
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@colors.zip" "${{ secrets.UPLOAD_COLORS_URL }}"


      - name: Zip param folder
        run: cd param && zip -r ../param.zip *

      - name: Upload param
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@param.zip" "${{ secrets.UPLOAD_PARAM_URL }}"


      - name: Zip rules folder
        run: cd rules && zip -r ../rules.zip *

      - name: Upload rules
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@rules.zip" "${{ secrets.UPLOAD_RULES_URL }}"


      - name: Zip shapes folder
        run: cd shapes && zip -r ../shapes.zip *

      - name: Upload shapes
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@shapes.zip" "${{ secrets.UPLOAD_SHAPES_URL }}"


      - name: Zip trial-lists folder
        run: cd trial-lists && zip -r ../trial-lists.zip *

      - name: Upload trial-lists
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@trial-lists.zip" "${{ secrets.UPLOAD_TRIAL_LISTS_URL }}"


      - name: Zip launch folder
        run: cd launch && zip -r ../launch.zip *

      - name: Upload launch
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@launch.zip" "${{ secrets.UPLOAD_LAUNCH_URL }}"
        
      
      - name: Zip modifiers folder
        run: cd modifiers && zip -r ../modifiers.zip *

      - name: Upload modifiers
        run: curl --fail -k -F "secret=${{ secrets.UPLOAD_SECRET }}" -F "build=@modifiers.zip" "${{ secrets.UPLOAD_MODIFIERS_URL }}"

