name: Regenerate ssh ci runner image

on:
  # pull_request:
  #   branches: ["main"]
  schedule:
    - cron: "0 0 1,8,15,22 * *"
  workflow_dispatch:

permissions:
  pull-requests: write
  contents: write
  packages: write

jobs:
  ssh-ci-rebuild:
    if: github.repository == 'TecharoHQ/anubis'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          fetch-tags: true
          fetch-depth: 0
          persist-credentials: false
      - name: Log into registry
        uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
      - name: Build and push
        run: |
          cd ./test/ssh-ci
          docker buildx bake --push
