Skip to content

Remove non-working config etc #114

Remove non-working config etc

Remove non-working config etc #114

Workflow file for this run

name: 'Build mkosi image'
on:
workflow_dispatch:
push:
branches: ['main']
tags: ['*']
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
python3 python3-pip python-is-python3 python3-pyelftools python3-pefile pipx \
qemu-user-static binfmt-support bubblewrap dosfstools mtools uidmap debian-archive-keyring \
binutils-aarch64-linux-gnu jq rename
- run: |
pipx ensurepath
pipx install git+https://github.com/systemd/mkosi.git@v24.3
- name: Setup mkosi cache
id: mkosi-cache
uses: actions/cache/restore@v4
with:
path: mkosi.cache.tar.zst
key: mkosi-${{ hashFiles('mkosi.conf') }}
- name: Extract cache
if: steps.mkosi-cache.outputs.cache-hit == 'true'
run: sudo tar -xf mkosi.cache.tar.zst --use-compress-program zstdmt
- name: Setup mkosi
run: |
touch mkosi.key mkosi.crt
chmod 0600 mkosi.key mkosi.crt
cat << EOF > mkosi.key
${{ secrets.MKOSI_KEY }}
EOF
cat << EOF > mkosi.crt
${{ secrets.MKOSI_CRT }}
EOF
echo -n ${{ github.ref_name }} > mkosi.version
echo "OUTPUT_DIR=$(mkosi --json summary|jq -r '.Images[0].OutputDirectory')" >> $GITHUB_ENV
echo "OUTPUT=$(mkosi --json summary|jq -r '.Images[0].Output')" >> $GITHUB_ENV
echo "IMAGE_ID=$(mkosi --json summary|jq -r '.Images[0].ImageId')" >> $GITHUB_ENV
- name: Build images
run: mkosi build
- name: Compress outputs
if: startsWith(github.ref, 'refs/tags/')
run: xz -0 ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT }}*.raw ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT }}*.efi
- name: Generate SHA256SUMS
if: startsWith(github.ref, 'refs/tags/')
working-directory: ${{ env.OUTPUT_DIR }}
env:
GH_TOKEN: ${{ github.token }}
run: |
rename 's/\.([a-f0-9]{32})/_$1/' ${{ env.OUTPUT }}.*.*.raw.xz
sha256sum ${{ env.OUTPUT }}*.raw.xz ${{ env.OUTPUT }}*.efi.xz >> SHA256SUMS
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
files: |
${{ env.OUTPUT_DIR }}/${{ env.OUTPUT }}*.raw.xz
${{ env.OUTPUT_DIR }}/${{ env.OUTPUT }}*.efi.xz
${{ env.OUTPUT_DIR }}/SHA256SUMS
- name: Build cache
if: "!startsWith(github.ref, 'refs/tags/')"
run: sudo tar -cf mkosi.cache.tar.zst mkosi.cache --use-compress-program zstdmt
- name: Save cache
if: "steps.mkosi-cache.outputs.cache-hit != 'true' && !startsWith(github.ref, 'refs/tags/')"
uses: actions/cache/save@v4
with:
path: mkosi.cache.tar.zst
key: mkosi-${{ hashFiles('mkosi.conf') }}