name: Build XMRig

on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  build-xmrig-linux-static:
    runs-on: ubuntu-latest

    steps:
      -
        name: Checkout code
        uses: actions/checkout@v3
      # -
      #   name: Set up QEMU
      #   uses: docker/setup-qemu-action@v3
      # -
      #   name: Set up Docker Buildx
      #   uses: docker/setup-buildx-action@v3
      # -
      #   name: Build and push
      #   uses: docker/build-push-action@v6
      #   with:
      #     push: false
      #     tags: xmrig:latest
      -
        name: Build XMRig
        run: |
          docker build -t xmrig:latest .
      -
        name: Copy XMRig
        run: |
          id=$(docker create xmrig:latest)
          docker cp $id:/xmrig/build/xmrig - > build/xmrig.tar
          tar -xvf build/xmrig.tar -C build && rm build/xmrig.tar
          docker rm -v $id
      -
        name: Archive artifacts
        # uses: actions/upload-artifact@v4
        uses: christopherhx/gitea-upload-artifact@v4
        with:
          name: xmrig
          path: build/xmrig
