name: 'Docker Setup'
description: 'Set up Docker Buildx and log in to Docker Hub'
inputs:
  docker_username:
    description: 'Docker Hub username'
    required: true
  docker_password:
    description: 'Docker Hub password'
    required: true
  github_token:
    description: 'GitHub token'
    required: true
runs:
  using: 'composite'
  steps:
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Log in to Docker Hub
      uses: docker/login-action@v3
      with:
        username: ${{ inputs.docker_username }}
        password: ${{ inputs.docker_password }}

    # This will be used as a secret to authenticate with Git repo pulls
    - name: Create .netrc file
      run: |
        echo "machine github.com" > ${{ runner.temp }}/netrc
        echo "login x-access-token" >> ${{ runner.temp }}/netrc
        echo "password ${{ inputs.github_token }}" >> ${{ runner.temp }}/netrc
      shell: bash
