Skip to content

Commit

Permalink
I don't need these
Browse files Browse the repository at this point in the history
included luci-app-mihomo, kkkgo/UE-DDNS, luci-app-tailscale and node_exporter

added Zephyruso/zashboard as default mihomo dashboard
supported One-KVM
  • Loading branch information
JohnsonRan committed Dec 8, 2024
1 parent 6369cbc commit 62df25f
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 366 deletions.
122 changes: 62 additions & 60 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
name: Build releases
name: Build OpenWrt

on:
workflow_dispatch:
inputs:
device:
description: 'Select the build device'
required: true
default: 'x86_64'
type: choice
options:
- 'armv8'
- 'nanopi-r4s'
- 'nanopi-r5s'
- 'netgear_r8500'
- 'x86_64'
version:
description: 'Select the build version'
required: true
Expand All @@ -25,11 +14,11 @@ on:
ccache:
description: 'Enable ccache (Use Cache to speed up next build)'
type: boolean
default: false
default: true
lan_addr:
description: 'Setting default LAN address'
required: true
default: '10.0.0.1'
default: '172.16.1.1'
type: string
build_options:
description: 'Build options (separate multiple options with spaces)'
Expand All @@ -39,8 +28,14 @@ on:

jobs:
build:
name: Build ${{ github.event.inputs.device }}
name: Build ${{ matrix.device }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
device:
- x86_64
- nanopi-r5s
defaults:
run:
shell: bash
Expand All @@ -50,14 +45,16 @@ jobs:
continue-on-error: true
uses: actions/checkout@main
with:
path: r4s_build_script
path: opwrt_build_script

- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
git config --global user.name 'actions'
git config --global user.email '[email protected]'
echo build_dir="/builder" >> "$GITHUB_ENV"
echo branch="openwrt-24.10" >> "$GITHUB_ENV"
[ "${{ matrix.device }}" = nanopi-r5s ] && echo arch="aarch64_generic" >> "$GITHUB_ENV" || echo arch="x86_64" >> "$GITHUB_ENV"
[ "${{ github.event.inputs.version }}" = release ] && echo build_version="rc2" >> "$GITHUB_ENV" || echo build_version="dev" >> "$GITHUB_ENV"
- name: Show system
Expand All @@ -79,7 +76,7 @@ jobs:
sudo curl -sL -o /usr/bin/caddy https://github.com/sbwml/r4s_build_script/releases/download/caddy/caddy
sudo chmod 755 /usr/bin/caddy
echo ":8080 {" > caddyfile
echo " root * $(pwd)/r4s_build_script" >> caddyfile
echo " root * $(pwd)/opwrt_build_script" >> caddyfile
echo " file_server browse" >> caddyfile
echo "}" >> caddyfile
sudo /usr/bin/caddy start --config caddyfile --adapter caddyfile
Expand All @@ -96,25 +93,25 @@ jobs:
uses: sbwml/actions@install-llvm

- name: Restore Cached
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device != 'armv8' && matrix.device != 'nanopi-r4s' }}
uses: actions/cache/restore@v4
with:
path: /builder/.ccache
key: openwrt-24.10-${{ github.event.inputs.device }}-ccache
key: openwrt-24.10-${{ matrix.device }}-ccache

- name: Restore Cached (releases)
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device == 'armv8' || matrix.device == 'nanopi-r4s' }}
continue-on-error: true
working-directory: /builder
run: |
curl -s https://api.github.com/repos/${{ github.repository }}/releases | grep 'browser_download_url' | grep ccache | grep ${{ github.event.inputs.device }} | awk -F '"' '{print $4}' | grep -v '^$' | xargs -n 1 wget -q
cat ${{ github.event.inputs.device }}.tar.* | tar -xf - || true
rm -rf ${{ github.event.inputs.device }}.tar.* || true
curl -s https://api.github.com/repos/${{ github.repository }}/releases | grep 'browser_download_url' | grep ccache | grep ${{ matrix.device }} | awk -F '"' '{print $4}' | grep -v '^$' | xargs -n 1 wget -q
cat ${{ matrix.device }}.tar.* | tar -xf - || true
rm -rf ${{ matrix.device }}.tar.* || true
[ -d .ccache ] && cache_size=$(du -sb .ccache | awk '{print $1}') || cache_size=0
cache_size_mb=$(echo "scale=0; ${cache_size} / (1024 * 1024)" | bc)
echo "Cache Size: ~${cache_size_mb} MB (${cache_size} B)"
echo "Cache restored successfully"
echo "Cache restored from key: ${{ github.event.inputs.device }}"
echo "Cache restored from key: ${{ matrix.device }}"
- name: Compile OpenWrt
working-directory: /builder
Expand All @@ -123,14 +120,15 @@ jobs:
run: |
export ${{ github.event.inputs.build_options }} LAN=${{ github.event.inputs.lan_addr }} USE_GCC15=y
[ ${{ github.event.inputs.ccache }} = 'true' ] && export ENABLE_CCACHE=y
bash <(curl -sS http://127.0.0.1:8080/build.sh) ${{ env.build_version }} ${{ github.event.inputs.device }}
bash <(curl -sS http://127.0.0.1:8080/build.sh) ${{ env.build_version }} ${{ matrix.device }}
cd openwrt
if [ "${{ github.event.inputs.version }}" = release ]; then
tags=OpenWrt-$(git describe --abbrev=0 --tags)
else
tags=snapshot-24.10-$(git log -n 1 --date=format:"%Y%m%d" --format="%cd")-$(git log --pretty=format:"%h" -1)
fi
echo "latest_release=$tags" >>$GITHUB_ENV
kernel=$(curl -s "https://raw.githubusercontent.com/${{ github.repository }}/master/tags/kernel-6.12" | awk -F"LINUX_KERNEL_HASH-| =" '/LINUX_KERNEL_HASH/{print $2}')
echo "latest_release=$tags-k$kernel" >>$GITHUB_ENV
- name: Extensive logs after a failed compilation
working-directory: /builder
Expand All @@ -140,33 +138,33 @@ jobs:
make V=s
- name: Delete Cached
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device != 'armv8' && matrix.device != 'nanopi-r4s' }}
continue-on-error: true
working-directory: /builder
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
gh cache delete openwrt-24.10-${{ github.event.inputs.device }}-ccache || true
gh cache delete openwrt-24.10-${{ matrix.device }}-ccache || true
- name: Save Cached
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device != 'armv8' && github.event.inputs.device != 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device != 'armv8' && matrix.device != 'nanopi-r4s' }}
continue-on-error: true
uses: actions/cache/save@v4
with:
path: /builder/.ccache
key: openwrt-24.10-${{ github.event.inputs.device }}-ccache
key: openwrt-24.10-${{ matrix.device }}-ccache

- name: Create ccache tar files
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device == 'armv8' || matrix.device == 'nanopi-r4s' }}
continue-on-error: true
working-directory: /builder
run: |
mkdir -p ccache
tar cf - .ccache | split -d -b 1800m - ccache/${{ github.event.inputs.device }}.tar.
tar cf - .ccache | split -d -b 1800m - ccache/${{ matrix.device }}.tar.
- name: Upload Cached (releases - ccache)
if: ${{ github.event.inputs.ccache == 'true' && github.event.inputs.device == 'armv8' || github.event.inputs.device == 'nanopi-r4s' }}
if: ${{ github.event.inputs.ccache == 'true' && matrix.device == 'armv8' || matrix.device == 'nanopi-r4s' }}
continue-on-error: true
uses: ncipollo/[email protected]
with:
Expand All @@ -184,49 +182,27 @@ jobs:
working-directory: /builder
run: |
mkdir -p rom info
if [ "${{ github.event.inputs.device }}" = "nanopi-r4s" ]; then
cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/
cp -a openwrt/bin/targets/rockchip/*/*-r4s.manifest info/manifest.txt
cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo
cd rom && sha256sum *gz > ../info/sha256sums.txt
elif [ "${{ github.event.inputs.device }}" = "nanopi-r5s" ]; then
cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/
if [ "${{ matrix.device }}" = "nanopi-r5s" ]; then
cp -a openwrt/bin/targets/rockchip/*/*-r5s-squashfs-sysupgrade.img.gz rom/
cp -a openwrt/bin/targets/rockchip/*/*.manifest info/manifest.txt
cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo
cd rom && sha256sum *gz > ../info/sha256sums.txt
elif [ "${{ github.event.inputs.device }}" = "x86_64" ]; then
cp -a openwrt/bin/targets/x86/*/*-ext4-combined-efi.img.gz rom/
elif [ "${{ matrix.device }}" = "x86_64" ]; then
cp -a openwrt/bin/targets/x86/*/*-squashfs-combined-efi.img.gz rom/
cp -a openwrt/bin/targets/x86/*/*-generic-rootfs.tar.gz rom/
cp -a openwrt/bin/targets/x86/*/*-x86-64-generic.manifest info/manifest.txt
cp -a openwrt/bin/targets/x86/*/config.buildinfo info/config.buildinfo
cd rom && sha256sum *gz > ../info/sha256sums.txt
elif [ "${{ github.event.inputs.device }}" = "netgear_r8500" ]; then
cp -a openwrt/bin/targets/bcm53xx/generic/*-bcm53xx-generic-netgear_r8500-squashfs.chk rom/
cp -a openwrt/bin/targets/bcm53xx/generic/*.manifest info/manifest.txt
cp -a openwrt/bin/targets/bcm53xx/generic/config.buildinfo info/config.buildinfo
cd rom && sha256sum * > ../info/sha256sums.txt
elif [ "${{ github.event.inputs.device }}" = "armv8" ]; then
tar zcf rom/u-boot-qemu_armv8.tar.gz -C openwrt/bin/targets/armsr/armv8*/ ./u-boot-qemu_armv8
cp -a openwrt/bin/targets/armsr/armv8*/*-generic-initramfs-kernel.bin rom/
cp -a openwrt/bin/targets/armsr/armv8*/*-generic-kernel.bin rom/
cp -a openwrt/bin/targets/armsr/armv8*/*-generic-ext4-combined-efi.img.gz rom/
cp -a openwrt/bin/targets/armsr/armv8*/*-generic-squashfs-combined-efi.img.gz rom/
cp -a openwrt/bin/targets/armsr/armv8*/*-rootfs.tar.gz rom/
cp -a openwrt/bin/targets/armsr/armv8*/*.manifest info/manifest.txt
cp -a openwrt/bin/targets/armsr/armv8*/config.buildinfo info/config.buildinfo
cd rom && sha256sum * > ../info/sha256sums.txt
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.device }}-openwrt-${{ env.latest_release }}
name: ${{ matrix.device }}-openwrt-${{ env.latest_release }}
path: ${{ env.build_dir }}/rom/*

- name: Create release
continue-on-error: true
uses: ncipollo/release-action@v1
uses: ncipollo/release-action@v1.14.0
with:
name: ${{ env.latest_release }}
allowUpdates: true
Expand All @@ -235,3 +211,29 @@ jobs:
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.build_dir }}/rom/*

- name: Upload to Filen
id: upload
continue-on-error: true
working-directory: /builder/rom
timeout-minutes: 10
run: |
filen_version=$(curl -s https://api.github.com/repos/FilenCloudDienste/filen-cli/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/^v//')
sudo curl -skLo /bin/filen-cli https://github.com/FilenCloudDienste/filen-cli/releases/download/v$filen_version/filen-cli-$filen_version-linux-x64
sudo chmod +x /bin/filen-cli
export FILEN_EMAIL="${{ secrets.FILEN_EMAIL }}"
export FILEN_PASSWORD="${{ secrets.FILEN_PWD }}"
for FILE in *; do
if [ -f "$FILE" ]; then
echo "Uploading: $FILE"
filen-cli upload "$FILE" OpenWrt/${{ matrix.device }}
fi
done
filen-cli ls -l OpenWrt/${{ matrix.device }}
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 0
keep_minimum_runs: 2
Loading

0 comments on commit 62df25f

Please sign in to comment.