name: Reese's Arch Toolbox
run-name: Build and Push Reese's Arch Toolbox
on:
  push:
    paths:
      - active/software_distoolbox/**
      - .gitea/workflows/distoolbox.yaml
  schedule:
    - cron: '@daily'
jobs:
  build-and-push-arch-toolbox:
    runs-on: ubuntu-latest
    if: gitea.ref == 'refs/heads/main'
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: Login to Gitea Registry
        uses: docker/login-action@v2
        with:
          registry: gitea.reeseapps.com
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}
      - name: Build and push Docker image
        uses: https://github.com/docker/build-push-action@v5
        with:
          context: ${{ gitea.workspace }}/active/software_distoolbox
          file: ${{ gitea.workspace }}/active/software_distoolbox/arch-toolbox.containerfile
          target: cpu
          push: true
          tags: "gitea.reeseapps.com/services/arch-toolbox:latest,gitea.reeseapps.com/services/arch-toolbox:${{gitea.sha}}"
          no-cache: true
      - name: Build and push AMD GPU Docker image
        uses: https://github.com/docker/build-push-action@v5
        with:
          context: ${{ gitea.workspace }}/active/software_distoolbox
          file: ${{ gitea.workspace }}/active/software_distoolbox/arch-toolbox.containerfile
          target: amdgpu
          push: true
          tags: "gitea.reeseapps.com/services/arch-toolbox-amdgpu:latest,gitea.reeseapps.com/services/arch-toolbox-amdgpu:${{gitea.sha}}"
          no-cache: false