mirror of
https://github.com/t2linux/fedora-containers.git
synced 2026-08-16 05:18:31 -07:00
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Build and publish OCI image
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
image_name:
|
|
type: string
|
|
required: true
|
|
tags:
|
|
type: string
|
|
required: true
|
|
|
|
jobs:
|
|
build-image:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ inputs.image_name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- 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: github.ref == 'refs/heads/main'
|
|
uses: redhat-actions/podman-login@v1
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: t2linux
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push image to ghcr.io
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: redhat-actions/push-to-registry@v2
|
|
with:
|
|
image: ${{ steps.build-image.outputs.image }}
|
|
tags: ${{ steps.build-image.outputs.tags }}
|
|
registry: ${{ env.REGISTRY }}/t2linux
|