mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 22:09:53 +07:00
892c374946
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
260 lines
9.0 KiB
YAML
260 lines
9.0 KiB
YAML
#
|
|
# 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 Development
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
runs:
|
|
description: "runs-on"
|
|
type: choice
|
|
options:
|
|
- ubuntu-latest
|
|
- self-hosted
|
|
version:
|
|
description: "version (1.0.0)"
|
|
required: true
|
|
type: string
|
|
next:
|
|
description: "next"
|
|
default: true
|
|
type: boolean
|
|
stable:
|
|
description: "stable"
|
|
default: true
|
|
type: boolean
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ inputs.runs }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@main
|
|
|
|
# Install Dependencies
|
|
- name: Install Dependencies
|
|
if: ${{ inputs.runs == 'ubuntu-latest' }}
|
|
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 locales busybox dialog gettext sed gawk jq curl
|
|
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
|
# sudo snap install yq
|
|
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
|
|
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
|
|
fi
|
|
|
|
df -h
|
|
|
|
# Get extractor, LKM, Addons, Modules, Theme and Configs
|
|
- name: Get Buildroot
|
|
run: |
|
|
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
|
|
|
|
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"
|
|
|
|
# Export Dependencies Version to env
|
|
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
|
echo "MODULETAG=${MODULETAG}" >> $GITHUB_ENV
|
|
echo "CONFIGTAG=${CONFIGTAG}" >> $GITHUB_ENV
|
|
echo "PATCHTAG=${PATCHTAG}" >> $GITHUB_ENV
|
|
echo "CUSTOMTAG=${CUSTOMTAG}" >> $GITHUB_ENV
|
|
echo "LKMTAG=${LKMTAG}" >> $GITHUB_ENV
|
|
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
|
|
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
|
|
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
|
|
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
|
|
|
|
# Modify Source File
|
|
ARC_BUILD="`date +'%y%m%d'`"
|
|
ARC_VERSION="${{ inputs.version }}-dev"
|
|
ARC_BRANCH="next"
|
|
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
|
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
|
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
|
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
|
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
|
echo "ARC_BRANCH=${ARC_BRANCH}" >> $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"
|
|
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"
|
|
sudo 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 -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
|
|
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
|
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
|
|
|
# Zip image and generate checksum
|
|
- name: Pack Next Image
|
|
if: ${{ inputs.next == true }}
|
|
run: |
|
|
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhdx.zip" arc.vhdx
|
|
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
|
|
fi
|
|
|
|
# Cleanup
|
|
- name: Cleanup
|
|
run: |
|
|
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
|
|
|
|
# Build incremental
|
|
- name: Build Stable Image
|
|
if: ${{ inputs.stable }}
|
|
run: |
|
|
. scripts/func.sh
|
|
|
|
# Modify Source File
|
|
ARC_BUILD="`date +'%y%m%d'`"
|
|
ARC_VERSION="${{ inputs.version }}-dev"
|
|
ARC_BRANCH="stable"
|
|
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
|
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
|
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
|
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
|
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
|
echo "ARC_BRANCH=${ARC_BRANCH}" >> $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"
|
|
sudo 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 -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
|
|
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
|
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
|
|
|
# Zip image and generate checksum
|
|
- name: Pack Stable Image
|
|
if: ${{ inputs.stable }}
|
|
run: |
|
|
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
|
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhdx.zip" arc.vhdx
|
|
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
|
|
fi
|
|
|
|
# Publish a release if is a tag
|
|
- name: Release
|
|
if: success() && env.ARC_VERSION != ''
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.ARC_VERSION }}
|
|
prerelease: true
|
|
makeLatest: false
|
|
allowUpdates: true
|
|
body: |
|
|
### Note:
|
|
- Development Build
|
|
|
|
### Information:
|
|
- Full Changelog is available in my Discord
|
|
- Discord Account for Arc Patch needed
|
|
|
|
### Dependencies:
|
|
- Addons: ${{ env.ADDONTAG }}
|
|
- Modules: ${{ env.MODULETAG }}
|
|
- Configs: ${{ env.CONFIGTAG }}
|
|
- Patches: ${{ env.PATCHTAG }}
|
|
- Custom: ${{ env.CUSTOMTAG }}
|
|
- LKMs: ${{ env.LKMTAG }}
|
|
- Buildroot Stable: ${{ env.BRSTAG }}
|
|
- Buildroot Next: ${{ env.BRXTAG }}
|
|
|
|
### Release
|
|
- ${{ env.BUILD_TIME }}
|
|
artifacts: |
|
|
arc-*.zip
|
|
update-*.zip
|