This repository was archived by the owner on May 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathaction.yml
More file actions
69 lines (65 loc) · 2.26 KB
/
action.yml
File metadata and controls
69 lines (65 loc) · 2.26 KB
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
60
61
62
63
64
65
66
67
68
69
name: "Docker image build defaults"
description: "Defaults for building docker images"
branding:
icon: "box"
color: "gray-dark"
inputs:
username:
description: "Docker username"
required: false
default: ""
password:
description: "Docker password"
required: false
default: ""
registry:
description: "Docker Registry"
required: false
default: "docker.io"
runs:
using: "composite"
steps:
## Set some vars to be used in the build process
- name: Set Vars
id: set_vars
shell: bash
run: |
event=${{ github.event_name }}
case ${event} in
pull_request|pull_request_target|pull_request_review)
echo "[PR]: true"
branch=${{ github.event.pull_request.head.ref }}
;;
*)
echo "[PR]: false"
branch=${GITHUB_REF#refs/heads/}
;;
esac
echo "BRANCH_NAME=$branch" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "GITHUB_REF_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "DOCKER_PUSH=${{ (inputs.username != '') && (inputs.password != '') }}" >> $GITHUB_ENV
## Setup QEMU for multi-arch builds
- name: Set up QEMU
id: docker_qemu
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
with:
cache-image: false # don't cache the binfmt image
## Setup docker buildx
- name: Set up Docker Buildx
id: docker_buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
cache-binary: false
## Login to docker registry
- name: Docker Login
if: |
inputs.username != '' &&
inputs.password != ''
id: docker_login
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}
logout: true