-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (47 loc) · 1.54 KB
/
component-container-image.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
name: Build and push Docker image
on:
workflow_call:
inputs:
context:
description: "Path to the Dockerfile directory to build"
default: "."
type: string
image-path:
description: "Path of the docker image Tag"
default: "ghcr.io/${{ github.repository }}/app"
type: string
jobs:
container-image-build:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- id: format
name: Lowercase repository path
uses: ASzc/change-string-case-action@v1
with:
string: ${{ inputs.image-path }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ github.event_name == 'release' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
if: ${{ github.event_name != 'release' }}
with:
context: "{{defaultContext}}:${{ inputs.context }}"
tags: "${{ steps.format.outputs.lowercase }}:develop"
push: false
- name: Build and push
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'release' }}
with:
context: "{{defaultContext}}:${{ inputs.context }}"
tags: "${{ steps.format.outputs.lowercase }}:${{ github.ref_name }}"
push: true