name: Build Tavernworks
run-name: Building on Silverymoon by ${{ gitea.actor }}.
on:
  push:
    branches:
      - main

jobs:
  Explore-Gitea-Actions:
    runs-on: FreeBSD-14.1
    env:
      SOURCE_DIR: tavernworks
      TARGET_DIR: /usr/local/bin
    steps:
      - name: Setup Workspace
        run: |
          rm -rf ${{ github.workspace }}/*
          echo "Source Dir: $SOURCE_DIR"
      - name: Clone Repo
        uses: https://gitea.com/actions/checkout@v4
        with:
          repository: CyberMages/website
          token: ${{ secrets.CM_GIT_TOKEN }}
          path: ${{ env.SOURCE_DIR }}
      - name: Build Repo
        run: |
          pwd
          ls -la
          cd "$SOURCE_DIR"
          echo "Current Shell: $SHELL"
          echo "PATH=$PATH"
          . ~/.profile
          echo "PATH=$PATH"
          echo "Building release."
          cargo build --release
          echo "Installing loreweaver."
          cp ./target/release/loreweaver "$TARGET_DIR"
      - name: Clean Workspace
        run: |
          rm -rf ${{ github.workspace }}/*
          ls -la
