name: Build & Release
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on:
  push:
    tags:
      - "v*"

jobs:
  Windows-AMD64-Build:
    runs-on: windows-x86_64
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3

      - name: Building/Compiling/Installing Project
        run: |
          cd ${{ gitea.workspace }}
          cmake -A x64 -DCMAKE_BUILD_TYPE=Release --preset=default .
          cd build
          cmake --build . --config Release

      - name: Creating Appropriate Directories
        run: |
          cd ${{ gitea.workspace }}
          mv build/Release/Pong.exe .
          mv build/Release/zlib1.dll .

      - name: Zipping Binaries
        run: |
          cd ${{ gitea.workspace }}
          tar -a -c -f pong-windows-amd64.zip Pong.exe zlib1.dll resources

      - uses: https://github.com/actions/setup-go@v4
        with:
          go-version: '>=1.20.1'

      - name: Use Go Action
        id: use-go-action
        uses: https://gitea.com/actions/release-action@main
        with:
          files: |-
            pong-windows-amd64.zip
          api_key: '${{secrets.RELEASE_TOKEN}}'

  Linux-AMD64-Build:
    runs-on: linux-x86_64
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3

      - name: Installing Dependencies
        run: |
          sudo pacman -S --noconfirm zip alsa-lib libxcb xcb-util-cursor vulkan-headers mesa

      - name: Building/Compiling/Installing Project
        run: |
          cd ${{ gitea.workspace }}
          cmake -DCMAKE_BUILD_TYPE=Release .
          cmake --build . --config Release

      - name: Zipping Binaries
        run: zip -r pong-linux-amd64.zip Pong resources

      - uses: https://github.com/actions/setup-go@v4
        with:
          go-version: '>=1.20.1'

      - name: Use Go Action
        id: use-go-action
        uses: https://gitea.com/actions/release-action@main
        with:
          files: |-
            pong-linux-amd64.zip
          api_key: '${{secrets.RELEASE_TOKEN}}'

  Linux-AARCH64-Build:
    runs-on: linux-aarch64
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3

      - name: Installing Dependencies
        run: sudo apt install -y zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev vulkan-headers

      - name: Building/Compiling/Installing Project
        run: |
          cd ${{ gitea.workspace }}
          cmake -DCMAKE_BUILD_TYPE=Release .
          cmake --build . --config Release

      - name: Zipping Binaries
        run: zip -r pong-linux-aarch64.zip Pong resources

      - uses: https://github.com/actions/setup-go@v4
        with:
          go-version: '>=1.20.1'

      - name: Use Go Action
        id: use-go-action
        uses: https://gitea.com/actions/release-action@main
        with:
          files: |-
            pong-linux-aarch64.zip
          api_key: '${{secrets.RELEASE_TOKEN}}'