forked from k0sproject/k0s
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.43 KB
/
build-airgap-image-bundle.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Build :: Airgap image bundle"
on:
workflow_call:
inputs:
target-os:
type: string
description: The OS to build the airgap image bundle for.
target-arch:
type: string
required: true
description: The architecture to build the airgap image bundle for.
outputs:
cache-key:
description: The airgap image bundle's cache key.
value: ${{ jobs.build.outputs.cache-key }}
env:
MAKEFLAGS: -j
jobs:
build:
name: "${{ inputs.target-os }}-${{ inputs.target-arch }}"
runs-on: ubuntu-22.04
env:
TARGET_OS: ${{ inputs.target-os }}
TARGET_ARCH: ${{ inputs.target-arch }}
steps:
- name: "Build :: Checkout"
uses: actions/checkout@v4
with:
persist-credentials: false
- name: "Download :: Airgap image list"
uses: actions/download-artifact@v4
with:
name: airgap-image-list-${{ inputs.target-os }}-${{ inputs.target-arch }}
# Capture the calculated image bundle source hash in a separate step, as
# the hashFiles function is evaluated before the step execution. So all
# the required files need to exist before that.
- name: "Cache :: Airgap image bundle :: Calculate cache key"
id: cache-airgap-image-bundle-calc-key
env:
HASH_VALUE: ${{ hashFiles('Makefile', 'airgap-images.txt', 'hack/image-bundler/*') }}
run: |
printf 'cache-key=build-airgap-image-bundle-%s-%s-%s\n' "$TARGET_OS" "$TARGET_ARCH" "$HASH_VALUE" >> "$GITHUB_OUTPUT"
- name: "Cache :: Airgap image bundle"
id: cache-airgap-image-bundle
uses: actions/cache@v4
with:
key: ${{ steps.cache-airgap-image-bundle-calc-key.outputs.cache-key }}
path: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar
- name: "Build :: Airgap image bundle"
if: steps.cache-airgap-image-bundle.outputs.cache-hit != 'true'
run: |
mkdir -p "embedded-bins/staging/$TARGET_OS/bin"
make --touch airgap-images.txt
make "airgap-image-bundle-$TARGET_OS-$TARGET_ARCH.tar"
- name: "Upload :: Airgap image bundle"
uses: actions/upload-artifact@v4
with:
name: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}
path: airgap-image-bundle-${{ inputs.target-os }}-${{ inputs.target-arch }}.tar
compression-level: 0