55
66jobs :
77 build :
8- strategy :
9- matrix :
10- profiles :
11- - verity-full,docker-ext
12- - verity-full,docker
138 runs-on : ubuntu-latest
149 permissions :
1510 contents : write
@@ -78,20 +73,35 @@ jobs:
7873 cat <<EOF > mkosi.key
7974 $MANGOS_KEY
8075 EOF
76+ - name : Inject GnuPG key
77+ env :
78+ MANGOS_GNUPG_KEY : ${{ secrets.MANGOS_GNUPG_KEY }}
79+ run : |
80+ set -e
81+ if [ -z "${MANGOS_GNUPG_KEY}" ]; then
82+ echo '::warning title=Missing key::`MANGOS_GNUPG_KEY` was not set. Generating temporary key.'
83+ echo '`MANGOS_GNUPG_KEY` was not set. Build performed with ephemeral key.' >> ${GITHUB_STEP_SUMMARY}
84+ GNUPGHOME=$(pwd)/.gnupg gpg --batch --passphrase '' --quick-generate-key "ephemeral github.com/${GITHUB_REPOSITORY} signing Key"
85+ exit 0
86+ fi
87+ GNUPGHOME=$(pwd)/.gnupg gpg --batch --import <<EOF
88+ $MANGOS_GNUPG_KEY
89+ EOF
8190 - name : Download Hashistack
8291 run : |
8392 ./hashiext-download.sh
8493 - name : Run mkosi
8594 env :
86- profiles : ${{ matrix.profiles }}
8795 MANGOS_GITHUB_URL : ${{ github.server_url }}/${{ github.repository }}
8896 run : |
89- mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},hashistack"
90- mkosi -E RUNNER_ENVIRONMENT --debug --profile= --profile="${profiles},installer"
97+ mkosi -E RUNNER_ENVIRONMENT --debug
98+ rm *.zip mkosi.images/*/bin/*
9199 - name : List built artifacts
92- run : find out/
100+ run : ls out/
93101 - name : Export image version for later steps
94102 run : echo IMAGE_VERSION="$(./mkosi.version)" >> $GITHUB_ENV
103+ - name : Free Disk Space (Ubuntu)
104+ uses : jlumbroso/free-disk-space@main
95105 - name : Test it
96106 run : |
97107 #!/bin/bash
@@ -110,7 +120,7 @@ jobs:
110120 shopt -s nullglob
111121 for file in out/mangos{,-installer}_${IMAGE_VERSION}.{raw,efi} out/docker*_${IMAGE_VERSION}.raw
112122 do
113- zstd --rm "$file"
123+ test -f "${file}" && zstd --rm "$file"
114124 done
115125# - name: Sign artifacts
116126# run: for file in out/mangos* ; do cosign sign-blob -d -y --bundle "${file}.sigbundle" "${file}" > /dev/null; done
@@ -136,31 +146,27 @@ jobs:
136146 out/mangos-installer_${{ env.IMAGE_VERSION }}.github.json
137147 out/mangos-installer_${{ env.IMAGE_VERSION }}.spdx.json
138148 out/mangos-installer_${{ env.IMAGE_VERSION }}.syft.json
139- name : mangos.${{ matrix.profiles }}
140-
141- release :
142- if : github.ref_type == 'tag'
143- runs-on : ubuntu-latest
144- needs :
145- - build
146- permissions :
147- contents : write
148- steps :
149- - name : Download artifacts
150- uses : actions/download-artifact@v4
151- with :
152- path : artifacts
153- - name : Rename artifacts
154- run : |
155- mkdir release
156-
157- mv artifacts/mangos.verity-full,docker-ext/* release/
158- for f in artifacts/mangos.verity-full,docker/* ; do
159- [ "$(basename $f)" == "mangosctl" ] && continue
160- mv "$f" "release/mangos+docker_$(basename $f | cut -f2- -d_)"
161- done
162149 - name : Release
150+ if : github.ref_type == 'tag'
163151 uses : softprops/action-gh-release@v2
164152 with :
165153 draft : true
166- files : release/*
154+ files : |
155+ out/mangos_${{ env.IMAGE_VERSION }}.efi.zst
156+ out/mangos_${{ env.IMAGE_VERSION }}.root-x86-64.*.zst
157+ out/mangos_${{ env.IMAGE_VERSION }}.root-x86-64-verity.*.zst
158+ out/mangos_${{ env.IMAGE_VERSION }}.root-x86-64-verity-sig.*.zst
159+ out/mangos_${{ env.IMAGE_VERSION }}.raw.zst
160+ out/mangos_${{ env.IMAGE_VERSION }}.cyclonedx.json
161+ out/mangos_${{ env.IMAGE_VERSION }}.github.json
162+ out/mangos_${{ env.IMAGE_VERSION }}.spdx.json
163+ out/mangos_${{ env.IMAGE_VERSION }}.syft.json
164+ out/mangos_${{ env.IMAGE_VERSION }}.manifest
165+ out/mangosctl
166+ out/docker*_${{ env.IMAGE_VERSION }}.raw.zst
167+ out/mangos-installer_${{ env.IMAGE_VERSION }}.raw.zst
168+ out/mangos-installer_${{ env.IMAGE_VERSION }}.cyclonedx.json
169+ out/mangos-installer_${{ env.IMAGE_VERSION }}.github.json
170+ out/mangos-installer_${{ env.IMAGE_VERSION }}.spdx.json
171+ out/mangos-installer_${{ env.IMAGE_VERSION }}.syft.json
172+
0 commit comments