mirror of
https://github.com/AuxXxilium/arc-v.git
synced 2024-11-23 23:11:05 +07:00
d2f9f703ad
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
247 lines
8.2 KiB
YAML
247 lines
8.2 KiB
YAML
#
|
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
|
#
|
|
# This is free software, licensed under the MIT License.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
name: Build Arc
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "format %y.%-m.$i or auto"
|
|
required: false
|
|
type: string
|
|
next:
|
|
description: "-next Release"
|
|
required: false
|
|
type: boolean
|
|
prerelease:
|
|
description: "pre release"
|
|
default: false
|
|
type: boolean
|
|
clean:
|
|
description: "clean"
|
|
default: false
|
|
type: boolean
|
|
br_version:
|
|
description: "buildroot version"
|
|
default: "2023.02.x"
|
|
type: string
|
|
addons_version:
|
|
description: "addons version"
|
|
default: ""
|
|
type: string
|
|
configs_version:
|
|
description: "configs version"
|
|
default: ""
|
|
type: string
|
|
modules_version:
|
|
description: "modules version"
|
|
default: ""
|
|
type: string
|
|
lkm_version:
|
|
description: "lkm version"
|
|
default: ""
|
|
type: string
|
|
patches_version:
|
|
description: "patches version"
|
|
default: ""
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@main
|
|
|
|
- name: Clean Old
|
|
if: inputs.clean == true
|
|
uses: Nats-ji/delete-old-releases@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
keep-count: 10
|
|
keep-old-minor-releases: false
|
|
|
|
- name: Changelog
|
|
uses: Bullrich/generate-release-changelog@master
|
|
id: Changelog
|
|
env:
|
|
REPO: ${{ github.repository }}
|
|
|
|
# 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"
|
|
|
|
# Clean up disk space
|
|
docker rmi $(docker images -q)
|
|
sudo apt update
|
|
sudo apt -y purge azure-cli* docker* llvm* google* dotnet* powershell* sphinxsearch* mysql* php*
|
|
sudo apt -y full-upgrade
|
|
|
|
sudo apt update
|
|
sudo apt install -y jq gawk libelf-dev qemu-utils
|
|
sudo snap install yq
|
|
|
|
# calculates the version number and push
|
|
- name: Calculate Version
|
|
run: |
|
|
# Calculate Version
|
|
VERSION=""
|
|
if [ -n "${{ inputs.version }}" ]; then
|
|
VERSION="${{ inputs.version }}"
|
|
else
|
|
LATEST_TAG="$(curl -skL "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r ".tag_name" 2>/dev/null)"
|
|
if [[ -n "${LATEST_TAG}" && "`echo ${LATEST_TAG} | cut -d '.' -f 1,2`" = "`date +'%y.%-m.%-d'`" ]]; then # format %y.%-m.$i
|
|
VERSION="`echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.'`"
|
|
else
|
|
VERSION="`date +'%y.%-m.%-d'`"
|
|
fi
|
|
fi
|
|
|
|
if [ "${{ inputs.next }}" = "true" ]; then
|
|
VERSION="${VERSION}-next"
|
|
fi
|
|
|
|
echo "Version: ${VERSION}"
|
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
|
|
|
if [ -n "${VERSION}" ]; then
|
|
# Modify Source File
|
|
echo "${VERSION}" >VERSION
|
|
echo "${VERSION}" >files/p1/ARC-VERSION
|
|
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh
|
|
fi
|
|
|
|
# Get extractor, LKM, Addons, Modules and Configs
|
|
- name: Get extractor, LKM, Addons, Extensions, Modules and Configs
|
|
run: |
|
|
. scripts/func.sh
|
|
|
|
getExtractor "files/p3/extractor"
|
|
LKMTAG="${{ inputs.lkm_version }}"
|
|
getLKMs "files/p3/lkms" ${{ inputs.prerelease }}
|
|
echo "LKMTAG=${TAG}" >> $GITHUB_ENV
|
|
ADDONSTAG="${{ inputs.addons_version }}"
|
|
getAddons "files/p3/addons" ${{ inputs.prerelease }}
|
|
echo "ADDONSTAG=${TAG}" >> $GITHUB_ENV
|
|
MODULESTAG="${{ inputs.modules_version }}"
|
|
getModules "files/p3/modules" ${{ inputs.prerelease }}
|
|
echo "MODULESTAG=${TAG}" >> $GITHUB_ENV
|
|
CONFIGSTAG="${{ inputs.configs_version }}"
|
|
getConfigs "files/p3/configs" ${{ inputs.prerelease }}
|
|
echo "CONFIGSTAG=${TAG}" >> $GITHUB_ENV
|
|
PATCHESTAG="${{ inputs.patches_version }}"
|
|
getPatches "files/p3/patches" ${{ inputs.prerelease }}
|
|
echo "PATCHESTAG=${TAG}" >> $GITHUB_ENV
|
|
|
|
echo "OK"
|
|
|
|
# Build incremental
|
|
- name: Build Image
|
|
run: |
|
|
. scripts/func.sh
|
|
|
|
echo "Create Arc Image"
|
|
IMAGE_FILE="arc.img"
|
|
gzip -dc "files/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"
|
|
|
|
echo "Get Buildroot"
|
|
br_version="${{ inputs.br_version }}"
|
|
[ -z "${br_version}" ] && br_version="2023.02.x"
|
|
getBuildroot "${br_version}" "br"
|
|
[ ! -f "br/bzImage-arc" ] || [ ! -f "br/initrd-arc" ] && return 1
|
|
|
|
echo "Repack initrd"
|
|
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
|
|
repackInitrd "br/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 "Create Arc_4GB Image"
|
|
resizeImg "arc.img" "+3072M" "arc_4GB.img"
|
|
|
|
echo "Image Converter"
|
|
qemu-img convert -O vmdk arc.img arc-dyn.vmdk
|
|
qemu-img convert -O vmdk -o adapter_type=lsilogic arc.img -o subformat=monolithicFlat arc.vmdk
|
|
qemu-img convert -O vmdk arc_4GB.img arc_4GB-dyn.vmdk
|
|
qemu-img convert -O vmdk -o adapter_type=lsilogic arc_4GB.img -o subformat=monolithicFlat arc_4GB.vmdk
|
|
|
|
# Zip image and generate checksum
|
|
- name: Pack
|
|
run: |
|
|
if [ -n "${{ env.VERSION }}" ]; then
|
|
zip -9 "arc-${{ env.VERSION }}.img.zip" arc.img
|
|
zip -9 "arc_4GB-${{ env.VERSION }}.img.zip" arc_4GB.img
|
|
zip -9 "arc-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
|
|
zip -9 "arc_4GB-${{ env.VERSION }}.vmdk-dyn.zip" arc_4GB-dyn.vmdk
|
|
zip -9 "arc-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
|
zip -9 "arc_4GB-${{ env.VERSION }}.vmdk-flat.zip" arc_4GB.vmdk arc-flat.vmdk
|
|
else
|
|
zip -9 "arc.img.zip" arc.img
|
|
zip -9 "arc_4GB.img.zip" arc_4GB.img
|
|
fi
|
|
zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/boot/grub/grub.cfg"
|
|
|
|
# Upload artifact
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v3
|
|
if: env.VERSION != ''
|
|
with:
|
|
name: Images
|
|
path: |
|
|
arc.img.zip
|
|
arc_4GB.img.zip
|
|
update.zip
|
|
retention-days: 5
|
|
|
|
# Publish a release if is a tag
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: env.VERSION != ''
|
|
with:
|
|
tag_name: ${{ env.VERSION }}
|
|
prerelease: ${{ inputs.prerelease }}
|
|
body: |
|
|
Buildroot: ${{ inputs.br_version }}
|
|
Addons: ${{ env.ADDONSTAG }}
|
|
Configs: ${{ env.CONFIGSTAG }}
|
|
Modules: ${{ env.MODULESTAG }}
|
|
Patches: ${{ env.PATCHESTAG }}
|
|
LKM: ${{ env.LKMTAG }}
|
|
${{ steps.Changelog.outputs.changelog }}
|
|
files: |
|
|
arc-${{ env.VERSION }}.img.zip
|
|
arc_4GB-${{ env.VERSION }}.img.zip
|
|
arc-${{ env.VERSION }}.vmdk-dyn.zip
|
|
arc_4GB-${{ env.VERSION }}.vmdk-dyn.zip
|
|
arc-${{ env.VERSION }}.vmdk-flat.zip
|
|
arc_4GB-${{ env.VERSION }}.vmdk-flat.zip
|
|
update.zip |