-
Notifications
You must be signed in to change notification settings - Fork 7
78 lines (67 loc) · 2.36 KB
/
Copy pathbuild-node-image.yaml
File metadata and controls
78 lines (67 loc) · 2.36 KB
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
75
76
77
78
name: Build and Push Node Image
on:
push:
branches: [main]
paths:
- 'node-images/fedora/**'
pull_request:
paths:
- 'node-images/fedora/**'
workflow_dispatch:
inputs:
push:
description: 'Push image to registry'
required: false
default: 'false'
type: boolean
env:
PUSH_REGISTRY: ghcr.io/alicefr/bink
PUSH_IMAGE: node
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
container:
image: quay.io/fedora/fedora:43
options: --privileged --device /dev/kvm -v /var/lib/containers
steps:
- name: Install dependencies
run: dnf install -y --setopt=install_weak_deps=0 podman git make
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push)
run: podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Build bootc image
working-directory: node-images/fedora
run: make build-bootc-image
- name: Build disk image
working-directory: node-images/fedora
run: make build-disk-image
- name: Determine image tag
id: meta
working-directory: node-images/fedora
run: |
TAG=$(make -s print-image-tag)
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "Image tag: ${TAG}"
- name: Tag and push
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push)
working-directory: node-images/fedora
run: |
TAG=${{ steps.meta.outputs.tag }}
BOOTC_SRC=$(make -s print-bootc-image)
DISK_SRC=$(make -s print-node-image)
PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }}
# push bootc image under both :latest and versioned tags
podman tag ${BOOTC_SRC} ${PUSH_DEST}:${TAG}
podman push ${PUSH_DEST}:${TAG}
podman tag ${BOOTC_SRC} ${PUSH_DEST}:latest
podman push ${PUSH_DEST}:latest
# push disk image under both :latest-disk and versioned tags
podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk
podman push ${PUSH_DEST}:${TAG}-disk
podman tag ${DISK_SRC} ${PUSH_DEST}:latest-disk
podman push ${PUSH_DEST}:latest-disk