name: Build Mod
on:
  workflow_dispatch:
    inputs:
      mod_name:
        description: 'Mod name'
        default: 'TheOnlyCure'
        required: true
      version:
        description: 'Version'
        default: '1.0'
        required: true
jobs:
  main_job:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - run: mkdir -p root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}
    - run: cp workshop.txt  root/${{ inputs.mod_name }}/workshop.txt
    - run: cp preview.png root/${{ inputs.mod_name}}/preview.png
    - run: cp mod.info root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}/mod.info
    - run: cp icon.png root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}/icon.png
    - run: cp generic.png root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}/generic.png
    - run: cp -r media root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}/media
    - uses: actions/upload-artifact@v3
      with:
        name: ${{ inputs.mod_name }}-${{ inputs.version }}
        path: |
          root
          root/${{ inputs.mod_name }}
          root/${{ inputs.mod_name }}/Contents/
          root/${{ inputs.mod_name }}/Contents/mods
          root/${{ inputs.mod_name }}/Contents/mods/${{ inputs.mod_name }}/*
