name: Build Runner JS

on:
  schedule:
    - cron: '0 1 * * *'
  push:
    branches:
      - 'master'
      
jobs:
  build_lua:
    runs-on: 'docker'
    container:
      image: docker:27.5.1-alpine3.21
    strategy:
      matrix:
        version: [latest]
    steps:
      - name: Install Docker
        run: |
          rm $(which docker) && curl -fsSL https://get.docker.com | sh
      - name: Set up QEMU
        uses: 'https://git.euph.dev/actions/docker-setup-qemu@v3'
      - name: Setup Buildx
        uses: 'https://git.euph.dev/actions/docker-setup-buildx@v3'
      - name: Login to Registry
        uses: 'https://git.euph.dev/actions/docker-login@v3'
        with:
          registry: git.euph.dev
          username: ${{ secrets.DEPLOY_USER }}
          password: ${{ secrets.DEPLOY_SECRET }}
      - name: Build and push JS image
        uses: 'https://git.euph.dev/actions/docker-build-push@v5'
        with:
          context: "{{defaultContext}}:images/actions/js"
          push: true
          build-args: PACKAGE_VERSION=${{ matrix.version }}
          tags: |
            git.euph.dev/actions/runner-js-${{ matrix.version }}:latest
            git.euph.dev/actions/runner-js-${{ matrix.version }}:${{ forgejo.run_number }}