-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
70 lines (63 loc) · 2.03 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
60
61
62
63
64
65
66
67
68
69
70
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: ""
runs:
using: "composite"
steps:
## cleanup runner
- name: Cleanup Runner
id: runner_cleanup
uses: stacks-network/actions/cleanup/disk@main
## Checkout the code
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
## 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@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
## Setup docker buildx
- name: Set up Docker Buildx
id: docker_buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
## Login to dockerhub
- name: Login to DockerHub
if: |
inputs.username != '' &&
inputs.password != ''
id: docker_login
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
username: ${{ inputs.username }}
password: ${{ inputs.password }}