-
-
Notifications
You must be signed in to change notification settings - Fork 66
108 lines (90 loc) · 4.05 KB
/
lf-build-linux-aarch64.yml
File metadata and controls
108 lines (90 loc) · 4.05 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: 'Linuxfabrik: Build Linux (aarch64)'
on:
workflow_dispatch:
inputs:
target-distros:
description: 'Space-separated list of operating systems to compile on and build packages for. Supported: `debian11 debian12 debian13 rocky8 rocky9 rocky10 sle15 sle16 ubuntu2004 ubuntu2204 ubuntu2404 ubuntu2604`. Cannot be empty.'
required: true
default: 'debian11 debian12 debian13 rocky8 rocky9 rocky10 sle15 sle16 ubuntu2004 ubuntu2204 ubuntu2404 ubuntu2604'
version:
description: 'Package Version'
required: true
package-iteration:
description: 'The iteration number for the package (usually "1").'
required: true
default: '1'
# modify the default permissions granted to the GITHUB_TOKEN
permissions:
contents: 'read'
jobs:
prepare-matrix:
runs-on:
- 'ubuntu-24.04-arm'
outputs:
distro_list: '${{ steps.set-matrix.outputs.distro_list }}'
steps:
# Transform the space‐separated string into a valid JSON array using shell commands (with sed),
# then pass that result as an output to be used in the matrix of a subsequent job.
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
with:
egress-policy: audit
- id: set-matrix
run: |
# Grab the space-separated input value
input="${{ github.event.inputs.target-distros }}"
# Replace spaces with '","' using sed
json_array=$(echo "$input" | sed 's/ /","/g')
# Wrap the result in a JSON array
json_array='["'"$json_array"'"]'
echo "Computed JSON array: $json_array"
echo "distro_list=$json_array" >> $GITHUB_OUTPUT
build-linux-aarch64:
needs: 'prepare-matrix'
runs-on:
- 'ubuntu-24.04-arm'
strategy:
matrix:
# Parse the JSON array output from the prepare-matrix job.
distro: '${{ fromJson(needs.prepare-matrix.outputs.distro_list) }}'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
with:
egress-policy: audit
- name: 'Set environment variables for the build scripts'
run: |
echo "LFMP_ARCH=aarch64" >> $GITHUB_ENV
echo "LFMP_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "LFMP_PACKAGE_ITERATION=${{ github.event.inputs.package-iteration }}" >> $GITHUB_ENV
# Each matrix job gets one distro value here (to parallelize job runs and avoiding Github's 6h timeout).
echo "LFMP_TARGET_DISTROS=${{ matrix.distro }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "LFMP_DIR_REPOS=$GITHUB_WORKSPACE/repos" >> $GITHUB_ENV
echo "LFMP_DIR_REPO_MP=$GITHUB_WORKSPACE/repos/monitoring-plugins" >> $GITHUB_ENV
echo "LFMP_DIR_PACKAGED=$RUNNER_TEMP/lfmp/packaged" >> $GITHUB_ENV
- name: 'Create working directories'
run: |
mkdir -p $LFMP_DIR_REPOS
mkdir -p $LFMP_DIR_PACKAGED
- name: 'git clone https://github.com/Linuxfabrik/THIS-REPO'
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
with:
path: '${{ env.LFMP_DIR_REPO_MP }}'
- name: 'Debug'
run: >
/bin/bash
$LFMP_DIR_REPO_MP/build/debug.sh
- name: 'Install podman'
run: >
/bin/bash
$LFMP_DIR_REPO_MP/build/install-podman.sh
- name: 'For each distro create package'
run: >
/bin/bash $LFMP_DIR_REPO_MP/build/matrix-package.sh
- name: 'Upload the packages (rpm, deb)'
uses: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' # v7.0.1
with:
compression-level: 8
path: '${{ env.LFMP_DIR_PACKAGED }}/*'
name: "lfmp-${{ env.LFMP_VERSION }}-${{ env.LFMP_PACKAGE_ITERATION }}.packaged.${{ env.LFMP_ARCH }}.${{ env.LFMP_TARGET_DISTROS }}"