52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: "Setup Docker"
|
|
|
|
inputs:
|
|
username:
|
|
description: "Username"
|
|
required: true
|
|
password:
|
|
description: "Password"
|
|
required: true
|
|
ghcr_username:
|
|
description: "GHCR username. Usually set from the github.actor variable"
|
|
required: true
|
|
ghcr_password:
|
|
description: "GHCR password. Usually set from the secrets.GITHUB_TOKEN variable"
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get Short SHA
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Set up QEMU
|
|
# https://github.com/docker/setup-qemu-action/releases/tag/v3.6.0
|
|
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
|
|
|
- name: Set up Docker Buildx
|
|
# https://github.com/docker/setup-buildx-action/releases/tag/v3.10.0
|
|
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
|
|
with:
|
|
version: latest
|
|
|
|
- name: Login to DockerHub
|
|
if: ${{ github.event_name == 'release' || github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.password != '' }}
|
|
# https://github.com/docker/login-action/releases/tag/v3.4.0
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
|
|
with:
|
|
username: ${{ inputs.username }}
|
|
password: ${{ inputs.password }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: ${{ github.event_name == 'release' || github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ghcr_password != '' }}
|
|
# https://github.com/docker/login-action/releases/tag/v3.4.0
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ inputs.ghcr_username }}
|
|
password: ${{ inputs.ghcr_password }}
|