-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.38 KB
/
build-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
50
51
52
53
54
55
name: Build and publish OCI image
on:
workflow_call:
inputs:
image_name:
type: string
required: true
tags:
type: string
required: true
branch:
type: string
required: true
publish:
type: boolean
default: false
required: false
jobs:
build-image:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ inputs.image_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ inputs.tags }}
context: ./${{ env.IMAGE_NAME }}
containerfiles: |
${{ env.IMAGE_NAME }}/Containerfile
- name: Log in to ghcr.io
if: inputs.publish == true
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: t2linux
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image to ghcr.io
if: inputs.publish == true
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}/t2linux