Skip to content

Build SNAPSHOT

Build SNAPSHOT #702

name: Build SNAPSHOT
on:
workflow_dispatch:
schedule:
- cron: 0 16 * * *
jobs:
build:
name: Build ${{ matrix.model }}-${{ matrix.tag.version }}
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
model:
- nanopi-r4s
- nanopi-r5s
- x86_64
- netgear_r8500
tag:
- type: dev
version: openwrt-23.05
steps:
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
git config --global user.name 'actions'
git config --global user.email '[email protected]'
echo WORKDIR="/builder" >> "$GITHUB_ENV"
- name: Show system
run: |
echo -e "\n\e[1;32mCPU:\e[0m"
echo "$(grep 'model name' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}') ($(grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}')MHz) x $(grep processor /proc/cpuinfo | wc -l)"
echo -e "\n\e[1;32mMemory:\e[0m"
free -h
echo -e "\n\e[1;32mStorage:\e[0m"
df -Th / /mnt
echo -e "\n\e[1;32mSystem:\e[0m"
lsb_release -a
echo -e "\n\e[1;32mKernel:\e[0m"
uname -a
echo
- name: Free disk space
uses: sbwml/actions@free-disk
with:
build-mount-path: /builder
- name: Build System Setup
uses: sbwml/actions@openwrt-build-setup
- name: Install LLVM
uses: sbwml/actions@install-llvm
- name: Compile OpenWrt
id: compile
continue-on-error: true
working-directory: /builder
env:
git_password: ${{ secrets.ftp_password }}
run: |
[ "${{ matrix.model }}" != "netgear_r8500" ] && export KERNEL_CLANG_LTO=y
export BUILD_FAST=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y USE_GCC15=y ENABLE_MOLD=y
bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }}
build_date=$(date "+%Y-%m-%d")
echo "build_date=$build_date" >> $GITHUB_ENV
- name: Extensive logs after a failed compilation
if: steps.compile.outcome == 'failure'
working-directory: /builder
run: |
cd openwrt
make V=s
- name: Assemble Artifact
working-directory: /builder
run: |
mkdir -p rom info
if [ "${{ matrix.model }}" = "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 [ "${{ matrix.model }}" = "nanopi-r5s" ]; then
cp -a openwrt/bin/targets/rockchip/*/*.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 [ "${{ matrix.model }}" = "x86_64" ]; then
cp -a openwrt/bin/targets/x86/*/*-ext4-combined-efi.img.gz rom/
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 [ "${{ matrix.model }}" = "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
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.build_date }}-${{ matrix.model }}-${{ matrix.tag.version }}
path: ${{ env.WORKDIR }}/rom/*.*
- name: Install aliyunpan & login
working-directory: /builder
run: |
if [ "${{ matrix.model }}" = "nanopi-r4s" ]; then
device_id=${{ secrets.device_id_r4s_dev }}
elif [ "${{ matrix.model }}" = "nanopi-r5s" ]; then
device_id=${{ secrets.device_id_r5s_dev }}
elif [ "${{ matrix.model }}" = "x86_64" ]; then
device_id=${{ secrets.device_id_x86_dev }}
elif [ "${{ matrix.model }}" = "netgear_r8500" ]; then
device_id=${{ secrets.device_id_netgear_dev }}
fi
sudo wget -q ${{ secrets.aliyunpan_go }} -O /bin/aliyunpan
sudo chmod 0755 /bin/aliyunpan
sudo sh -c 'echo "${{ secrets.aliyunpan_us_node }} api.alipan.com auth.alipan.com www.alipan.com" >> /etc/hosts'
export ALIYUNPAN_CONFIG_DIR="$(pwd)/.aliyunpan"
aliyun_token=`curl -s ${{ secrets.aliyun_token }} | openssl enc -aes-256-cfb -pbkdf2 -a -d -k ${{ secrets.token_dec }}`
aliyunpan config set -device_id=$device_id >/dev/null 2>&1
echo
echo $aliyun_token | aliyunpan login
- name: Upload Firmware - snapshots
working-directory: /builder
run: |
export ALIYUNPAN_CONFIG_DIR="$(pwd)/.aliyunpan"
DATE=$(date "+%Y-%m-%d")
branch=23.05-SNAPSHOT
if [ "${{ matrix.model }}" = "nanopi-r4s" ]; then
aliyunpan upload --timeout 30 --retry 10 --ow info/config.buildinfo openwrt/nanopi-r4s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/manifest.txt openwrt/nanopi-r4s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/sha256sums.txt openwrt/nanopi-r4s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r4s-ext4-sysupgrade.img.gz openwrt/nanopi-r4s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r4s-squashfs-sysupgrade.img.gz openwrt/nanopi-r4s/snapshots/$branch/$DATE/
elif [ "${{ matrix.model }}" = "nanopi-r5s" ]; then
aliyunpan upload --timeout 30 --retry 10 --ow info/config.buildinfo openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/manifest.txt openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/sha256sums.txt openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r5c-ext4-sysupgrade.img.gz openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r5c-squashfs-sysupgrade.img.gz openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r5s-ext4-sysupgrade.img.gz openwrt/nanopi-r5s/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-r5s-squashfs-sysupgrade.img.gz openwrt/nanopi-r5s/snapshots/$branch/$DATE/
elif [ "${{ matrix.model }}" = "x86_64" ]; then
aliyunpan upload --timeout 30 --retry 10 --ow info/config.buildinfo openwrt/x86_64/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/manifest.txt openwrt/x86_64/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/sha256sums.txt openwrt/x86_64/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-generic-rootfs.tar.gz openwrt/x86_64/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-ext4-combined-efi.img.gz openwrt/x86_64/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*-squashfs-combined-efi.img.gz openwrt/x86_64/snapshots/$branch/$DATE/
elif [ "${{ matrix.model }}" = "netgear_r8500" ]; then
aliyunpan upload --timeout 30 --retry 10 --ow info/config.buildinfo openwrt/netgear-r8500/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/manifest.txt openwrt/netgear-r8500/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow info/sha256sums.txt openwrt/netgear-r8500/snapshots/$branch/$DATE/
aliyunpan upload --timeout 30 --retry 10 --ow rom/*.chk openwrt/netgear-r8500/snapshots/$branch/$DATE/
fi
aliyunpan recycle delete -all
echo y | aliyunpan logout