name: Publish launcher manifest and files

on:
  push:
    tags:
    - 'v*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Install dependencies
        run: sudo apt-get install -y python3-paramiko python3-lxml
      - uses: actions/checkout@v3.6.0
        with:
          submodules: 'recursive'
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v3.2.0
        with:
          dotnet-version: 9.0.x
      - name: Install dependencies
        run: dotnet restore
      - name: Set version
        run: echo "${{ github.ref }}" > ./Nebula.Launcher/Version.txt
      - name: Build whole project
        run: dotnet build --configuration Release
      - name: Package launcher files
        run: dotnet run --project Nebula.Packager
      - name: FTP Deploy Release
        uses: SamKirkland/FTP-Deploy-Action@v4.3.5
        with:
          server: ${{ secrets.FTP_SERVER }}
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: ./release/
          server-dir: ./
