arc/.github/workflows/build.yml

271 lines
8.8 KiB
YAML
Raw Normal View History

#
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Build Arc Image
on:
workflow_dispatch:
inputs:
version:
description: "version"
required: false
type: string
notice:
description: "Notice here"
required: false
type: string
latest:
description: "latest"
default: true
type: boolean
prerelease:
description: "pre release"
default: false
type: boolean
next:
description: "next"
default: true
type: boolean
stable:
description: "stable"
default: true
type: boolean
clean:
description: "clean"
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Delete releases and workflows runs
if: inputs.clean == true
uses: ophub/delete-releases-workflows@main
with:
delete_releases: true
releases_keep_latest: 1
delete_workflows: true
workflows_keep_day: 1
delete_tags: true
gh_token: ${{ secrets.GITHUB_TOKEN }}
# Install Dependencies
- name: Install Dependencies
run: |
git config --global user.email "info@auxxxilium.tech"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
sudo snap install yq
df -h
# calculates the version number and push
- name: Calculate Version
run: |
# Calculate Version
VERSION=""
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="`date +'%y.%m.%d'`"
fi
echo "Version: ${VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
if [ -n "${VERSION}" ]; then
echo "${VERSION}" >VERSION
echo "${VERSION}" >files/p1/ARC-VERSION
fi
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Dependencies for all Image
run: |
. scripts/func.sh
echo "Get Dependencies"
getAddons "files/p3/addons"
getModules "files/p3/modules"
getConfigs "files/p3/configs"
getPatches "files/p3/patches"
getCustom "files/p3/custom"
getOffline "files/p3/configs"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getBuildrootx "brx"
getBuildroots "brs"
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
# Build incremental
- name: Build Next Image
if: inputs.next == true
run: |
. scripts/func.sh
ARCBRANCH="next"
echo "${ARCBRANCH}" >files/p1/ARC-BRANCH
echo "ARCBRANCH=${ARCBRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "brx/bzImage-arc" ] || [ ! -f "brx/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brx/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -Rf "files/p1/"* "/tmp/p1"
sudo cp -Rf "files/p3/"* "/tmp/p3"
sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack Next Image
if: inputs.next == true
run: |
if [ -n "${{ env.VERSION }}" ]; then
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.img.zip" arc.img
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vhdx.zip" arc.vhdx
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.VERSION }}-${{ env.ARCBRANCH }}.zip ./p1 ./p3)
fi
# Cleanup
- name: Cleanup
run: |
rm -rf "arc.img" "arc.ova" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
# Build incremental
- name: Build Stable Image
if: inputs.stable == true
run: |
. scripts/func.sh
ARCBRANCH="stable"
echo "${ARCBRANCH}" >files/p1/ARC-BRANCH
echo "ARCBRANCH=${ARCBRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "brs/bzImage-arc" ] || [ ! -f "brs/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brs/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -Rf "files/p1/"* "/tmp/p1"
sudo cp -Rf "files/p3/"* "/tmp/p3"
sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack Stable Image
if: inputs.stable == true
run: |
if [ -n "${{ env.VERSION }}" ]; then
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.img.zip" arc.img
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.vhdx.zip" arc.vhdx
zip -9 "arc-${{ env.VERSION }}-${{ env.ARCBRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.VERSION }}-${{ env.ARCBRANCH }}.zip ./p1 ./p3)
fi
# Publish a release if is a tag
- name: Release
if: success() && env.VERSION != ''
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
prerelease: ${{ inputs.prerelease }}
makeLatest: ${{ inputs.latest }}
allowUpdates: true
body: |
### Information:
Notice: ${{ inputs.notice }}
Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
### Versions:
- next: Next Image (Full Image, all dependencies are included, DSM files will be loaded from the Internet, more features/hardware support)
- stable: Stable Image (Full Image, all dependencies are included, DSM files will be loaded from the Internet, less features/hardware support)
### Release
${{ env.BUILD_TIME }}
artifacts: |
arc-*.zip
update-*.zip