arc/.github/workflows/build.yml
AuxXxilium 04990a0fb8 build: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-09-27 22:05:59 +02:00

293 lines
9.7 KiB
YAML

#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Build Arc
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
clean:
description: "clean"
default: false
type: boolean
update_version:
description: "update min version"
default: "24.09.22"
type: string
jobs:
build:
runs-on: self-hosted
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
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get extractor, LKM, Addons, Modules, Theme and Configs
run: |
. scripts/func.sh
getLKMs "files/p3/lkms"
echo "LKMTAG=${TAG}" >> $GITHUB_ENV
getAddons "files/p3/addons"
echo "ADDONSTAG=${TAG}" >> $GITHUB_ENV
getModules "files/p3/modules"
echo "MODULESTAG=${TAG}" >> $GITHUB_ENV
getConfigs "files/p3/configs"
echo "CONFIGSTAG=${TAG}" >> $GITHUB_ENV
getPatches "files/p3/patches"
echo "PATCHESTAG=${TAG}" >> $GITHUB_ENV
getCustom "files/p3/custom"
echo "CUSTOMTAG=${TAG}" >> $GITHUB_ENV
getTheme "files/p1/boot/grub"
echo "THEMETAG=${TAG}" >> $GITHUB_ENV
getBuildrootx "latest" "brx"
echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV
getBuildroots "latest" "brs"
echo "BRS_VERSION=${TAG}" >> $GITHUB_ENV
getOffline "files/p3/offline"
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
# Build incremental
- name: Build Image S
run: |
. scripts/func.sh
if [ -n "${VERSION}" ]; then
# Modify Source File
echo "${VERSION}" >VERSION
echo "${VERSION}" >files/p1/ARC-VERSION
echo "stable" >files/p1/ARC-BRANCH
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh
fi
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"
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
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip update and generate checksum
cp -f files/p1/ARC-VERSION files/p3/ARC-VERSION
cp -f files/p1/ARC-BRANCH files/p3/ARC-BRANCH
cp -f files/p1/boot/grub/grub.cfg files/p3/grub.cfg
cd files/p3
zip -9 update.zip -r .
sha256sum update.zip >checksum.sha256
mv update.zip ../
mv checksum.sha256 ../
cd -
# Build incremental
- name: Build Image X
run: |
. scripts/func.sh
if [ -n "${VERSION}" ]; then
# Modify Source File
echo "${VERSION}" >VERSION
echo "${VERSION}" >files/p1/ARC-VERSION
echo "next" >files/p1/ARC-BRANCH
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh
fi
echo "Create Arc Image"
IMAGE_FILE="arc-next.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"
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-next-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc-next.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc-next.vhdx
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc-next.ova"
# Zip update and generate checksum
cp -f files/p1/ARC-VERSION files/p3/ARC-VERSION
cp -f files/p1/ARC-BRANCH files/p3/ARC-BRANCH
cp -f files/p1/boot/grub/grub.cfg files/p3/grub.cfg
cd files/p3
zip -9 update-next.zip -r .
sha256sum update-next.zip >checksum-next.sha256
mv update-next.zip ../
mv checksum-next.sha256 ../
cd -
# Zip image and generate checksum
- name: Pack
run: |
if [ -n "${{ env.VERSION }}" ]; then
# XBase
zip -9 "arc-${{ env.VERSION }}-next.img.zip" arc-next.img
zip -9 "arc-${{ env.VERSION }}-next.vmdk-dyn.zip" arc-next-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}-next.vmdk-flat.zip" arc-next.vmdk arc-next-flat.vmdk
zip -9 "arc-${{ env.VERSION }}-next.vhdx.zip" arc-next.vhdx
zip -9 "arc-${{ env.VERSION }}-next.ova.zip" arc-next.ova
# SBase
zip -9 "arc-${{ env.VERSION }}.img.zip" arc.img
zip -9 "arc-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.VERSION }}.ova.zip" arc.ova
fi
echo "${{ inputs.update_version }}" >check.update
# 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 }}
- Version:
- arc: Stable Buildroot System (Less Hardware supported / faster Boot)
- arc-next: Latest Buildroot System (More Hardware supported (still in testing))
- Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
### Versions:
Addons: ${{ env.ADDONSTAG }}
Configs: ${{ env.CONFIGSTAG }}
Modules: ${{ env.MODULESTAG }}
Patches: ${{ env.PATCHESTAG }}
Custom: ${{ env.CUSTOMTAG }}
Theme: ${{ env.THEMETAG }}
LKM: ${{ env.LKMTAG }}
Buildroot: ${{ env.BRS_VERSION }} | Buildroot Next: ${{ env.BRX_VERSION }}
Release: ${{ env.BUILD_TIME }}
artifacts: |
arc-*.zip
files/update.zip
files/update-next.zip
files/checksum.sha256
files/checksum-next.sha256
check.update