-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
74 lines (68 loc) · 2.25 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
71
72
73
74
name: container-build-push
description: Simple github action that uses various docker actions to build and publish multiarch container images with meaningful tags.
inputs:
context:
description: "build's context is the set of files located in the specified path"
default: "."
file:
description: "path to the Dockerfile (default ./Dockerfile)"
default: "./Dockerfile"
checkout-deploy-key:
description: "checkout deploy key"
default: ""
registry:
description: "container registry"
default: ghcr.io
required: true
user:
description: "container registry user"
default: "${{ github.actor }}"
required: true
token:
description: "container registry token"
required: true
platforms:
description: "container target platforms"
default: "linux/amd64,linux/arm/v7,linux/arm64"
runs:
using: "composite"
steps:
- name: checkout with github token
uses: actions/checkout@v4
if: ${{ inputs.checkout-deploy-key == '' }}
- name: checkout with deploy key
uses: actions/checkout@v4
with:
ssh-key: "${{ inputs.checkout-deploy-key }}"
if: ${{ inputs.checkout-deploy-key != '' }}
- 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 }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.user }}
password: ${{ inputs.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=edge,branch=main
type=edge,branch=master
type=ref,event=branch
type=sha,prefix=,format=short
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
push: true
provenance: false # https://github.com/docker/build-push-action/issues/820
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ inputs.platforms }}