From db539246061f322c1b775f4ee7bd05586d6686a5 Mon Sep 17 00:00:00 2001 From: hexzhen3x7 Date: Wed, 2 Oct 2024 16:24:23 +0200 Subject: [PATCH] added --- .github/workflows/build-armbian.yml | 16 ++ .github/workflows/new_build-armbian.yml | 43 +++++ action.yml | 225 +++--------------------- action.yml.old | 211 ++++++++++++++++++++++ build.sh | 78 ++++---- 5 files changed, 336 insertions(+), 237 deletions(-) create mode 100644 .github/workflows/new_build-armbian.yml mode change 100755 => 100644 action.yml create mode 100644 action.yml.old mode change 100644 => 100755 build.sh diff --git a/.github/workflows/build-armbian.yml b/.github/workflows/build-armbian.yml index f8428dd426a9..71f2293015e1 100644 --- a/.github/workflows/build-armbian.yml +++ b/.github/workflows/build-armbian.yml @@ -30,7 +30,23 @@ jobs: cd build ./compile.sh docker + - name: Build Armbian + run: | + git clone --depth=1 https://github.com/armbian/build + cd build + ./compile.sh docker + env: + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + - name: Customize image run: | chmod +x userpatches/customize-image.sh ./compile.sh docker + + + - name: Upload Armbian image + uses: actions/upload-artifact@v2 + with: + name: armbian-image + path: build/output/images/ \ No newline at end of file diff --git a/.github/workflows/new_build-armbian.yml b/.github/workflows/new_build-armbian.yml new file mode 100644 index 000000000000..04c92fbdca5f --- /dev/null +++ b/.github/workflows/new_build-armbian.yml @@ -0,0 +1,43 @@ +name: Build Armbian + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Armbian + run: | + git clone --depth=1 https://github.com/armbian/build + cd build + ./compile.sh docker + env: + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + + - name: Upload Armbian image + uses: actions/upload-artifact@v2 + with: + name: armbian-image + path: build/output/images/ diff --git a/action.yml b/action.yml old mode 100755 new mode 100644 index 0b7a1f80eec9..2becdb2e4ff0 --- a/action.yml +++ b/action.yml @@ -1,211 +1,40 @@ -name: "Rebuild Armbian" -author: "https://github.com/armbian" -description: "Build Armbian Linux" -inputs: +name: Build Custom Armbian - armbian_token: - description: "GitHub installation access token" - required: true +on: + push: + branches: + - main - armbian_runner_clean: - description: "Make some space on GH runners" - required: false - default: "" +jobs: + build: + runs-on: ubuntu-latest - armbian_artifacts: - descriptions: "Upload PATH" - required: false - default: "build/output/images/" + steps: + - name: Checkout code + uses: actions/checkout@v2 - armbian_target: - description: "Build image or kernel" - required: false - default: "kernel" + - name: Set up Docker + uses: docker/setup-buildx-action@v1 - armbian_branch: - description: "Choose framework branch" - required: false - default: "main" + - name: Clone Armbian build repository + run: git clone https://github.com/armbian/build.git - armbian_kernel_branch: - description: "Choose kernel branch" - required: false - default: "current" - - armbian_release: - description: "Choose userspace release" - required: false - default: "jammy" - - armbian_version: - description: "Set different version" - required: false - default: "" - - armbian_board: - description: "Select hardware platform" - required: false - default: "uefi-x86" - - armbian_ui: - description: "Armbian user interface" - required: false - default: "server" - - armbian_compress: - description: "Armbian compress method" - required: false - default: "sha,img,xz" - - armbian_extensions: - description: "Armbian lists of extensions" - required: false - default: "" - - armbian_userpatches: - description: "Armbian userpatches path" - required: false - default: "" - - armbian_pgp_key: - description: "Armbian PGP key" - required: false - default: "" - - armbian_pgp_password: - description: "Armbian PGP password" - required: false - default: "" - - armbian_release_tittle: - description: "Armbian image" - required: false - default: "Armbian image" - - armbian_release_body: - description: "Armbian images" - required: false - default: "Build with [Armbian tools](https://github.com/armbian/build)" - -runs: - using: "composite" - - steps: - - - name: Free Github Runner - if: ${{ inputs.armbian_runner_clean != '' }} - uses: descriptinc/free-disk-space@main - with: - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - - name: "Import GPG key" - if: ${{ inputs.armbian_pgp_key != '' }} - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ inputs.armbian_pgp_key }} - passphrase: ${{ inputs.armbian_pgp_password }} - - - name: "Checkout Armbian os" - uses: actions/checkout@v4 - with: - repository: armbian/os - fetch-depth: 0 - clean: false - path: os - - - name: "Checkout Armbian build framework" - uses: actions/checkout@v4 - with: - repository: armbian/build - fetch-depth: 0 - clean: false - path: build - - - name: "Checkout customisations" - uses: actions/checkout@v4 - with: - fetch-depth: 0 - clean: false - path: custom - - - shell: bash + - name: Run Armbian build script run: | - - # read version from upstream Armbian OS - cat os/stable.json | jq '.version' | sed "s/\"//g" | sed 's/^/ARMBIAN_VERSION=/' >> $GITHUB_ENV - [[ "${{ inputs.armbian_version }}" != '' ]] && echo "ARMBIAN_VERSION=${{ inputs.armbian_version }}" >> $GITHUB_ENV - - # copy os userpatches and custom - mkdir -pv build/userpatches - rsync -av os/userpatches/. build/userpatches/ - [[ -d custom/userpatches ]] && rsync -av custom/userpatches/. build/userpatches/ - - - shell: bash - run: | - - # userspace decode - if [[ "${{ inputs.armbian_ui }}" == minimal ]]; then - BUILD_DESKTOP="no" - BUILD_MINIMAL="yes" - elif [[ "${{ inputs.armbian_ui }}" == server ]]; then - BUILD_DESKTOP="no" - BUILD_MINIMAL="no" - else - BUILD_DESKTOP="yes" - BUILD_MINIMAL="no" - DESKTOP_ENVIRONMENT="${{ inputs.armbian_ui }}" - DESKTOP_APPGROUPS_SELECTED="" - DESKTOP_ENVIRONMENT_CONFIG_NAME="config_base" - fi - - # go to build folder and checkout cd build - git checkout ${{ inputs.armbian_branch }} + ./compile.sh docker - # execute build command - ./compile.sh "${{ inputs.armbian_target }}" \ - REVISION="${{ env.ARMBIAN_VERSION }}" \ - BOARD="${{ inputs.armbian_board }}" \ - BRANCH="${{ inputs.armbian_kernel_branch }}" \ - RELEASE="${{ inputs.armbian_release }}" \ - KERNEL_CONFIGURE="no" \ - BUILD_DESKTOP="${BUILD_DESKTOP}" \ - BUILD_MINIMAL="${BUILD_MINIMAL}" \ - DESKTOP_ENVIRONMENT="${DESKTOP_ENVIRONMENT}" \ - DESKTOP_APPGROUPS_SELECTED="${DESKTOP_APPGROUPS_SELECTED}" \ - DESKTOP_ENVIRONMENT_CONFIG_NAME="${DESKTOP_ENVIRONMENT_CONFIG_NAME}" \ - ENABLE_EXTENSIONS="${{ inputs.armbian_extensions }}" \ - COMPRESS_OUTPUTIMAGE="${{ inputs.armbian_compress }}" \ - SHARE_LOG="yes" \ - EXPERT="yes" + - name: Add custom packages + run: | + cp -r /path/to/custom/packages/* build/userpatches/overlay/ - - name: Sign - shell: bash - if: ${{ inputs.armbian_pgp_password != '' }} + - name: Build image run: | - echo ${{ inputs.armbian_pgp_password }} | \ - gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes \ - build/output/images/*.img*.xz + cd build + ./compile.sh BOARD=bananapim2ultra BRANCH=current RELEASE=buster BUILD_MINIMAL=yes BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no - - uses: ncipollo/release-action@v1 + - name: Upload artifact + uses: actions/upload-artifact@v2 with: - tag: "${{ env.ARMBIAN_VERSION }}" - name: "${{ inputs.armbian_release_tittle }}" - artifacts: "${{ inputs.armbian_artifacts }}*" - allowUpdates: true - removeArtifacts: false - replacesArtifacts: true - makeLatest: true - token: "${{ inputs.armbian_token }}" - body: | - ${{ inputs.armbian_release_body }} - -branding: - icon: "check" - color: "red" - + name: armbian-image + path: build/output/images/*.img diff --git a/action.yml.old b/action.yml.old new file mode 100644 index 000000000000..0b7a1f80eec9 --- /dev/null +++ b/action.yml.old @@ -0,0 +1,211 @@ +name: "Rebuild Armbian" +author: "https://github.com/armbian" +description: "Build Armbian Linux" +inputs: + + armbian_token: + description: "GitHub installation access token" + required: true + + armbian_runner_clean: + description: "Make some space on GH runners" + required: false + default: "" + + armbian_artifacts: + descriptions: "Upload PATH" + required: false + default: "build/output/images/" + + armbian_target: + description: "Build image or kernel" + required: false + default: "kernel" + + armbian_branch: + description: "Choose framework branch" + required: false + default: "main" + + armbian_kernel_branch: + description: "Choose kernel branch" + required: false + default: "current" + + armbian_release: + description: "Choose userspace release" + required: false + default: "jammy" + + armbian_version: + description: "Set different version" + required: false + default: "" + + armbian_board: + description: "Select hardware platform" + required: false + default: "uefi-x86" + + armbian_ui: + description: "Armbian user interface" + required: false + default: "server" + + armbian_compress: + description: "Armbian compress method" + required: false + default: "sha,img,xz" + + armbian_extensions: + description: "Armbian lists of extensions" + required: false + default: "" + + armbian_userpatches: + description: "Armbian userpatches path" + required: false + default: "" + + armbian_pgp_key: + description: "Armbian PGP key" + required: false + default: "" + + armbian_pgp_password: + description: "Armbian PGP password" + required: false + default: "" + + armbian_release_tittle: + description: "Armbian image" + required: false + default: "Armbian image" + + armbian_release_body: + description: "Armbian images" + required: false + default: "Build with [Armbian tools](https://github.com/armbian/build)" + +runs: + using: "composite" + + steps: + + - name: Free Github Runner + if: ${{ inputs.armbian_runner_clean != '' }} + uses: descriptinc/free-disk-space@main + with: + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: "Import GPG key" + if: ${{ inputs.armbian_pgp_key != '' }} + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ inputs.armbian_pgp_key }} + passphrase: ${{ inputs.armbian_pgp_password }} + + - name: "Checkout Armbian os" + uses: actions/checkout@v4 + with: + repository: armbian/os + fetch-depth: 0 + clean: false + path: os + + - name: "Checkout Armbian build framework" + uses: actions/checkout@v4 + with: + repository: armbian/build + fetch-depth: 0 + clean: false + path: build + + - name: "Checkout customisations" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + clean: false + path: custom + + - shell: bash + run: | + + # read version from upstream Armbian OS + cat os/stable.json | jq '.version' | sed "s/\"//g" | sed 's/^/ARMBIAN_VERSION=/' >> $GITHUB_ENV + [[ "${{ inputs.armbian_version }}" != '' ]] && echo "ARMBIAN_VERSION=${{ inputs.armbian_version }}" >> $GITHUB_ENV + + # copy os userpatches and custom + mkdir -pv build/userpatches + rsync -av os/userpatches/. build/userpatches/ + [[ -d custom/userpatches ]] && rsync -av custom/userpatches/. build/userpatches/ + + - shell: bash + run: | + + # userspace decode + if [[ "${{ inputs.armbian_ui }}" == minimal ]]; then + BUILD_DESKTOP="no" + BUILD_MINIMAL="yes" + elif [[ "${{ inputs.armbian_ui }}" == server ]]; then + BUILD_DESKTOP="no" + BUILD_MINIMAL="no" + else + BUILD_DESKTOP="yes" + BUILD_MINIMAL="no" + DESKTOP_ENVIRONMENT="${{ inputs.armbian_ui }}" + DESKTOP_APPGROUPS_SELECTED="" + DESKTOP_ENVIRONMENT_CONFIG_NAME="config_base" + fi + + # go to build folder and checkout + cd build + git checkout ${{ inputs.armbian_branch }} + + # execute build command + ./compile.sh "${{ inputs.armbian_target }}" \ + REVISION="${{ env.ARMBIAN_VERSION }}" \ + BOARD="${{ inputs.armbian_board }}" \ + BRANCH="${{ inputs.armbian_kernel_branch }}" \ + RELEASE="${{ inputs.armbian_release }}" \ + KERNEL_CONFIGURE="no" \ + BUILD_DESKTOP="${BUILD_DESKTOP}" \ + BUILD_MINIMAL="${BUILD_MINIMAL}" \ + DESKTOP_ENVIRONMENT="${DESKTOP_ENVIRONMENT}" \ + DESKTOP_APPGROUPS_SELECTED="${DESKTOP_APPGROUPS_SELECTED}" \ + DESKTOP_ENVIRONMENT_CONFIG_NAME="${DESKTOP_ENVIRONMENT_CONFIG_NAME}" \ + ENABLE_EXTENSIONS="${{ inputs.armbian_extensions }}" \ + COMPRESS_OUTPUTIMAGE="${{ inputs.armbian_compress }}" \ + SHARE_LOG="yes" \ + EXPERT="yes" + + - name: Sign + shell: bash + if: ${{ inputs.armbian_pgp_password != '' }} + run: | + echo ${{ inputs.armbian_pgp_password }} | \ + gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes \ + build/output/images/*.img*.xz + + - uses: ncipollo/release-action@v1 + with: + tag: "${{ env.ARMBIAN_VERSION }}" + name: "${{ inputs.armbian_release_tittle }}" + artifacts: "${{ inputs.armbian_artifacts }}*" + allowUpdates: true + removeArtifacts: false + replacesArtifacts: true + makeLatest: true + token: "${{ inputs.armbian_token }}" + body: | + ${{ inputs.armbian_release_body }} + +branding: + icon: "check" + color: "red" + diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index a27f4b4e385f..0cea7c477cb4 --- a/build.sh +++ b/build.sh @@ -1,39 +1,39 @@ -#!/bin/bash -# build.sh - -reset; - -echo -e "Console - Armbian-Builder > started!" -echo -e "Console - Armbian-Builder > Setup your settings & run build!" - -while true; -do -read -p "Enter Board > " board -read -p "Enter Branch > " branch -read -p "Enter Release > " release - -read -p "Build Minimal?(Yy/Nn) > " bm -case $bm in - y|Y) bm="yes";; continue; - n|N) bm="no";; continue; - *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; -esac - -read -p "Build Desktop?(Yy/Nn) > " bm -case $bd in - y|Y) bd="yes";; continue; - n|N) bd="no";; continue; - *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; -esac - -read -p "Kernel Configure(Yy/Nn) > " kn -case $bm in - y|Y) kn="yes";; continue; - n|N) kn="no";; continue; - *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; -esac - -echo -e "Console - Armbian-Builder > Building for: $board with options: $branch, $release, Build-Minimal = $bm, Build-Desktop=$bd, Kernel-Configure=$kn !" - -./compile.sh BOARD=$board BRANCH=$branch RELEASE=$release BUILD_MINIMAL=$bm BUILD_DESKTOP=$bd KERNEL_CONFIGURE=kn -done + #!/bin/bash + # build.sh + + reset; + + echo -e "Console - Armbian-Builder > started!" + echo -e "Console - Armbian-Builder > Setup your settings & run build!" + + while true; + do + read -p "Enter Board > " board + read -p "Enter Branch > " branch + read -p "Enter Release > " release + + read -p "Build Minimal?(Yy/Nn) > " bm + case $bm in + y|Y) bm="yes";; continue; + n|N) bm="no";; continue; + *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; + esac + + read -p "Build Desktop?(Yy/Nn) > " bm + case $bd in + y|Y) bd="yes";; continue; + n|N) bd="no";; continue; + *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; + esac + + read -p "Kernel Configure(Yy/Nn) > " kn + case $bm in + y|Y) kn="yes";; continue; + n|N) kn="no";; continue; + *) echo "Invalid option. Defaulting to no minimal build."; bm="no";; + esac + + echo -e "Console - Armbian-Builder > Building for: $board with options: $branch, $release, Build-Minimal = $bm, Build-Desktop=$bd, Kernel-Configure=$kn !" + + ./compile.sh BOARD=$board BRANCH=$branch RELEASE=$release BUILD_MINIMAL=$bm BUILD_DESKTOP=$bd KERNEL_CONFIGURE=kn + done