Skip to content

Commit

Permalink
Optimize yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Dec 8, 2021
1 parent 8cf41ec commit b7629d7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build-armbian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ jobs:
echo "COMPILE_STARTINGTIME=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
ARR_RELEASE=("bionic" "focal" "hirsute" "bullseye" "buster" "stretch")
if [[ -n "${{ github.event.inputs.set_release }}" && -n "$(echo "${ARR_RELEASE[@]}" | grep -w "${{ github.event.inputs.set_release }}")" ]]; then
set_release="${{ github.event.inputs.set_release }}"
else
set_release="${{ github.event.inputs.set_release }}"
if [[ -z "${set_release}" || -z "$(echo "${ARR_RELEASE[@]}" | grep -w "${set_release}")" ]]; then
set_release="bullseye"
fi
echo "ARMBIAN_RELEASE=${set_release}" >> $GITHUB_ENV
ARR_BOARD=("lepotato" "odroidn2")
if [[ -n "${{ github.event.inputs.set_board }}" && -n "$(echo "${ARR_BOARD[@]}" | grep -w "${{ github.event.inputs.set_board }}")" ]]; then
set_board="${{ github.event.inputs.set_board }}"
else
set_board="${{ github.event.inputs.set_board }}"
if [[ -z "${set_board}" || -z "$(echo "${ARR_BOARD[@]}" | grep -w "${set_board}")" ]]; then
set_board="lepotato"
fi
echo "ARMBIAN_BOARD=${set_board}" >> $GITHUB_ENV
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/compile-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,17 @@ jobs:
echo "COMPILE_STARTINGTIME=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
ARR_BRANCH=("kernel.org" "flippy")
if [[ -n "${{ github.event.inputs.kernel_repo }}" && -n "$(echo "${ARR_BRANCH[@]}" | grep -w "${{ github.event.inputs.kernel_repo }}")" ]]; then
KERNEL_REPO="${{ github.event.inputs.kernel_repo }}"
else
KERNEL_REPO="kernel.org"
kernel_repo="${{ github.event.inputs.kernel_repo }}"
if [[ -z "${kernel_repo}" || -z "$(echo "${ARR_BRANCH[@]}" | grep -w "${kernel_repo}")" ]]; then
kernel_repo="kernel.org"
fi
echo "KERNEL_REPO=${KERNEL_REPO}" >> $GITHUB_ENV
echo "KERNEL_REPO=${kernel_repo}" >> $GITHUB_ENV
if [[ -n "${{ github.event.inputs.kernel_ver }}" ]]; then
KERNEL_VER="${{ github.event.inputs.kernel_ver }}"
else
KERNEL_VER="5.4.160_5.10.80"
kernel_ver="${{ github.event.inputs.kernel_ver }}"
if [[ -z "${kernel_ver}" ]]; then
kernel_ver="5.4.160_5.10.80"
fi
echo "KERNEL_VER=${KERNEL_VER}" >> $GITHUB_ENV
echo "KERNEL_VER=${kernel_ver}" >> $GITHUB_ENV
- name: Compile the Kernel [ -k ${{ env.KERNEL_VER }} -r ${{ env.KERNEL_REPO }} ]
id: compile
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/rebuild-armbian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:
sudo chown $USER:$GROUPS /workdir
# Get the url of the rebuild armbian file
if [[ -n "${{ github.event.inputs.armbian_url }}" ]]; then
armbian_url="${{ github.event.inputs.armbian_url }}"
else
armbian_down="https://armbian.tnahosting.net/dl/lepotato/archive/"
armbian_file=$(curl -s ${armbian_down} | grep -oE Armbian.*bullseye.*.img.xz | head -n 1)
armbian_url="${{ github.event.inputs.armbian_url }}"
if [[ -z "${armbian_url}" ]]; then
armbian_site="https://armbian.tnahosting.net/dl/lepotato/archive/"
armbian_name="Armbian.*bullseye.*.img.xz"
armbian_file=$(curl -s "${armbian_site}" | grep -oE "${armbian_name}" | head -n 1)
if [ -n "${armbian_file}" ]; then
armbian_url="${armbian_down}/${armbian_file}"
armbian_url="${armbian_site}/${armbian_file}"
else
echo -e "Invalid download path: [ ${armbian_down} ]"
echo -e "Invalid download path: [ ${armbian_site} ]"
exit 1
fi
fi
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/use-releases-file-to-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ name: Use Releases file to build armbian
on:
repository_dispatch:
workflow_dispatch:
inputs:
sel_tags_keywords:
description: "Select tags keywords: bullseye / focal"
required: false
default: "bullseye"

env:
UPLOAD_FIRMWARE: false
Expand Down Expand Up @@ -39,10 +44,15 @@ jobs:
id: rebuild
if: (!cancelled())
run: |
[ -d build/output/images ] || mkdir -p build/output/images
curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" | grep -o "Armbian_Aml_.*/Armbian_.*-trunk_.*.img.gz" | head -n 1 > DOWNLOAD_ARMBIAN
[ -s DOWNLOAD_ARMBIAN ] && wget -q -P build/output/images https://github.com/${GITHUB_REPOSITORY}/releases/download/$(cat DOWNLOAD_ARMBIAN)
cd build/output/images/ && gzip -df *.img.gz && sync
armbian_buildpath="build/output/images"
[ -d "${armbian_buildpath}" ] || mkdir -p "${armbian_buildpath}"
down_repo="https://api.github.com/repos/${GITHUB_REPOSITORY}/releases"
down_path="Armbian_Aml_${{ github.event.inputs.sel_tags_keywords }}.*/Armbian_.*-trunk_.*.img.gz"
down_filename="$(curl -s "${down_repo}" | grep -oE "${down_path}" | head -n 1)"
down_file="https://github.com/${GITHUB_REPOSITORY}/releases/download/${down_filename}"
[ -z "${down_file}" ] && echo "Invalid download file." && exit 1
wget -q -P "${armbian_buildpath}" "${down_file}" && sync
cd "${armbian_buildpath}" && gzip -df *.img.gz && sync
set_release="_"
out_releasename=$(ls -l *-trunk_* 2>/dev/null | awk '{print $9}' | head -n 1)
Expand Down

0 comments on commit b7629d7

Please sign in to comment.