-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
59 lines (56 loc) · 1.93 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: "Setup Docker Builder"
description: "Sets up a Docker multi-platform builder with GitHub Actions, including logging into GHCR and Docker Hub."
branding:
color: "orange"
icon: "arrow-up-circle"
inputs:
ghcr_user:
description: "The GitHub Container Registry user"
required: false
ghcr_token:
description: "The GitHub Container Registry token"
required: false
docker_hub_user:
description: "The Docker Hub user"
required: false
docker_hub_token:
description: "The Docker Hub token"
required: false
outputs:
cache_from:
description: "The cache_from value for docker/build-push-action"
value: ${{ steps.helpers.outputs.cache_from }}
cache_to:
description: "The cache_to value for docker/build-push-action"
value: ${{ steps.helpers.outputs.cache_to }}
runs:
using: "composite"
steps:
- uses: docker/setup-qemu-action@v3
- uses: crazy-max/ghaction-github-runtime@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: ${{ inputs.ghcr_user && inputs.ghcr_token }}
with:
registry: ghcr.io
username: ${{ inputs.ghcr_user }}
password: ${{ inputs.ghcr_token }}
- uses: docker/login-action@v3
if: ${{ inputs.docker_hub_user && inputs.docker_hub_token }}
with:
username: ${{ inputs.docker_hub_user }}
password: ${{ inputs.docker_hub_token }}
- id: helpers
shell: bash
run: |
if [[ "${{ github.actor }}" == "nektos/act" ]]; then
echo "cache_from=" >> $GITHUB_OUTPUT
echo "DOCKER_CACHE_FROM=" >> $GITHUB_ENV
echo "cache_to=" >> $GITHUB_OUTPUT
echo "DOCKER_CACHE_TO=" >> $GITHUB_ENV
else
echo "cache_from=type=gha" >> $GITHUB_OUTPUT
echo "DOCKER_CACHE_FROM=type=gha" >> $GITHUB_ENV
echo "cache_to=type=gha,mode=max" >> $GITHUB_OUTPUT
echo "DOCKER_CACHE_TO=type=gha,mode=max" >> $GITHUB_ENV
fi