-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
action.yaml
89 lines (82 loc) · 2.5 KB
/
action.yaml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: Build & publish image
inputs:
build_args:
description: Docker container build arguments (ARG)
required: false
cache:
default: false
description: Cache image
required: false
type: boolean
context:
default: "{{defaultContext}}"
description: Image build context
required: false
dockerfile:
default: "Dockerfile"
description: Dockerfile path relative to context
required: false
platforms:
default: "linux/amd64"
description: Docker build architectures (comma-separated)
required: false
push:
default: ${{ github.event_name != 'pull_request' }}
description: Push image to registry
required: false
type: boolean
registry:
default: "ghcr.io"
description: Image registry
required: false
username:
default: "${{ github.actor }}"
description: Registry username
required: false
password:
default: "${{ github.token }}"
description: Registry password
required: false
prefix:
default: "${{ github.repository }}"
description: Image prefix
required: false
subproject:
description: Subproject name
required: true
tags:
description: Full image names with tags
required: true
runs:
using: composite
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ inputs.registry }}
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: Extract container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}/${{ inputs.prefix }}/${{ inputs.subproject }}
- name: Build and push ${{ inputs.subproject }} container image
uses: docker/build-push-action@v5
with:
build-args: ${{ inputs.build_args }}
context: ${{ inputs.context || '{{defaultContext}}' }}
file: ${{ inputs.context || '.' }}/${{ inputs.dockerfile || 'Dockerfile' }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: ${{ !inputs.cache }}
platforms: ${{ inputs.platforms || 'linux/amd64' }}
push: ${{ inputs.push || github.event_name != 'pull_request' }}
tags: ${{ inputs.tags }}