Skip to content

Commit

Permalink
update interface
Browse files Browse the repository at this point in the history
  • Loading branch information
p5 committed Dec 20, 2024
1 parent eb5187e commit 4b6a27f
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ name: Build Image
on:
workflow_call:
inputs:
fedora_version:
description: "The Fedora release version: 39, 40, 41 etc"
image-registry:
description: "The registry to push the image to. E.G. ghcr.io/ublue-os"
required: true
type: string
fedora_edition:
description: "The Fedora Atomic edition: Silverblue, Kinoite etc"
default: "ghcr.io/${{ github.repository_owner }}"
image-name:
description: "The name of the image to build. E.G. main"
required: true
type: string
default: "${{ github.repository_name }}"
platforms:
description: "The platforms to build for: aarch64, x86_64 etc"
description: "The platforms to build for. E.G. aarch64, x86_64 etc"
required: true
type: string
tags:
description: "The tags to apply to the image"
required: true
type: string

env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ inputs.fedora_version }}-${{ inputs.fedora_edition }}-${{ inputs.platforms }}
cancel-in-progress: true
Expand Down Expand Up @@ -55,26 +54,44 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Image
id: build-image
env:
FEDORA_EDITION: ${{ inputs.fedora_edition }}
IMAGE_REGISTRY: ${{ inputs.image-registry }}
IMAGE_NAME: ${{ inputs.image-name }}
BUILD_ARGS_JSON: tojson(${{ inputs.build-args }})
run: |
podman build \
--iidfile /tmp/iidfile \
-t ${IMAGE_REGISTRY}/main-${FEDORA_EDITION}:local
-t ${IMAGE_REGISTRY}/${IMAGE_NAME}:local \
.
IMAGE_ID=$(cat /tmp/iidfile)
IMAGE_DIGEST=$(podman inspect --format '{{.Digest}}' $IMAGE_ID)
echo "IMAGE_DIGEST=${IMAGE_DIGEST}" >> $GITHUB_OUTPUT
- name: Push Image
env:
IMAGE_REGISTRY: ${{ inputs.image-registry }}
IMAGE_NAME: ${{ inputs.image-name }}
IMAGE_DIGEST: ${{ steps.build-image.outputs.IMAGE_DIGEST }}
run: |
for i in {1..3}; do
echo "podman push --digestfile=/tmp/digestfile ${IMAGE_REGISTRY}/${IMAGE_NAME}@${IMAGE_DIGEST}" && break || sleep $((10 ** i))
sleep 5
done
manifest:
runs-on: ubuntu-latest
needs: build
steps:
- name: Create Manifest
env:
IMAGE_REGISTRY: ${{ inputs.image-registry }}
IMAGE_NAME: ${{ inputs.image-name }}
run: |
podman manifest create build
podman manifest create ${IMAGE_REGISTRY}/${IMAGE_NAME}

0 comments on commit 4b6a27f

Please sign in to comment.