Skip to content

Commit

Permalink
Build: use image-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
stupidloud committed Mar 31, 2021
1 parent 80a6984 commit 8d93985
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 93 deletions.
96 changes: 59 additions & 37 deletions .github/workflows/lo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Custom configure file
run: |
cd ~/lede
cat $GITHUB_WORKSPACE/$DEVICE.config.seed | sed '/CONFIG_PACKAGE_luci-app-/d' > .config
cat $GITHUB_WORKSPACE/$DEVICE.config.seed | sed 's/\(CONFIG_PACKAGE_luci-app-.*=\)y/\1m/' > .config
- name: Build and deploy packages
run: |
Expand All @@ -98,17 +98,6 @@ jobs:
make -j$[`nproc`+1] IGNORE_ERRORS=1
mv `ls ~/lede/bin/targets/*/*/*imagebuilder*xz` ~/ib-$DEVICE.tar.xz
cat $GITHUB_WORKSPACE/$DEVICE.config.seed | sed '/CONFIG_PACKAGE_luci-app-/d' > .config
find package/ -type d -name luci-app-* | rev | cut -d'/' -f1 | rev | xargs -n1 -i echo "# CONFIG_PACKAGE_{} is not set" >> .config
make defconfig
mkdir -p files/local_feed/core files/local_feed/base
sudo mount --bind bin/targets/*/*/packages/ files/local_feed/core
sudo mount --bind bin/packages/*/base/ files/local_feed/base
pushd bin/ && . ../files/etc/opkg/distfeeds.conf | tee ../files/etc/opkg/distfeeds.conf && popd
make -j$[`nproc`+1]
sudo umount files/local_feed/core files/local_feed/base
rm files/etc/opkg/distfeeds.conf
echo "======================="
echo "Space usage:"
echo "======================="
Expand Down Expand Up @@ -191,6 +180,49 @@ jobs:
SSH_PUBKEY: ${{secrets.SSH_PUBKEY}}
NGROK_TOKEN: ${{secrets.NGROK_TOKEN}}

generate_slim_firmware:
needs: build_packages
name: Generate ${{ github.event.client_payload.device || github.event.inputs.device }} slim firmware
runs-on: ubuntu-18.04
env:
DEVICE: ${{ github.event.client_payload.device || github.event.inputs.device }}

steps:

- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Generate firmware
run: |
sudo sysctl vm.swappiness=0
curl -L https://github.com/klever1988/sshactions/releases/download/cache/ib-$DEVICE.tar.xz | tar -Jxvf -
mv *imagebuilder* ib && cd ib
mv $GITHUB_WORKSPACE/files ./
chmod 600 files/etc/dropbear/*
eval `cat .config | grep \" | head -n 10`
. files/etc/opkg/distfeeds.conf | tee files/etc/opkg/distfeeds.conf
mkdir -p files/local_feed && sudo mount --bind packages files/local_feed
sed -i 's/luci-app-[^ ]*//g' include/target.mk $(find target/ -name Makefile)
sed -i 's/$(OPKG) install $(BUILD_PACKAGES)/$(OPKG) install --force-overwrite $(BUILD_PACKAGES)/' Makefile
make image PACKAGES="$PACKAGES $LP luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn" FILES="files"
mkdir -p $GITHUB_WORKSPACE/release
mv $(ls -1 ./bin/targets/*/*/*img.gz) $GITHUB_WORKSPACE/release/$DEVICE-slim.img.gz
cd $GITHUB_WORKSPACE/release/ && md5sum $DEVICE-slim.img.gz > $DEVICE-slim.img.md5
echo "strDate=$(TZ=UTC-8 date +%Y-%m-%d)" >> $GITHUB_ENV
echo "strDevice=$(echo $DEVICE | awk '{print toupper($0)}')" >> $GITHUB_ENV
- name: Upload release asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./release/*
tag: ${{env.strDate}}
file_glob: true
overwrite: true
release_name: ${{env.strDate}} 自动发布

generate_firmware:
needs: build_packages
if: always()
Expand All @@ -208,19 +240,21 @@ jobs:
- name: Generate firmware
run: |
sudo sysctl vm.swappiness=0
nohup sudo rm -rf /usr/share/dotnet /usr/local/lib/android/sdk &
cd
sudo curl -sL https://raw.githubusercontent.com/klever1988/nanopi-openwrt/zstd-bin/zstd | sudo tee /usr/bin/zstd > /dev/null
for i in {1..10}
do
curl -sL --fail https://github.com/klever1988/sshactions/releases/download/cache/lede.$DEVICE.img.zst.0$i || break
done | zstdmt -d -o lede.img
LOOP_DEVICE=$(losetup -f) && echo "LOOP_DEVICE=$LOOP_DEVICE" >> $GITHUB_ENV
sudo losetup -P --direct-io $LOOP_DEVICE lede.img
mkdir lede && sudo mount -o nossd,compress=zstd $LOOP_DEVICE lede
cd lede
cat $GITHUB_WORKSPACE/$DEVICE.config.seed > .config
make defconfig && make -j$[`nproc`+1]
curl -L https://github.com/klever1988/sshactions/releases/download/cache/ib-$DEVICE.tar.xz | tar -Jxvf -
mv *imagebuilder* ib && cd ib
mv $GITHUB_WORKSPACE/files ./
chmod 600 files/etc/dropbear/*
eval `cat .config | grep \" | head -n 10`
. files/etc/opkg/distfeeds.conf | tee files/etc/opkg/distfeeds.conf
sed -i '/local/d;s/#//' files/etc/opkg/distfeeds.conf
cat files/etc/opkg/distfeeds.conf
sed -i 's/luci-app-[^ ]*//g' include/target.mk $(find target/ -name Makefile)
sed -i 's/$(OPKG) install $(BUILD_PACKAGES)/$(OPKG) install --force-overwrite $(BUILD_PACKAGES)/' Makefile
PACKAGES=$(cat $GITHUB_WORKSPACE/$DEVICE.config.seed | grep CONFIG_PACKAGE | sed '/dnsmasq_full_dhcpv6/d;/INCLUDE/d' | grep -v luci-app | sed 's/CONFIG_PACKAGE_//;s/=y//' | xargs echo)
PACKAGES=$(echo $PACKAGES `cat $GITHUB_WORKSPACE/$DEVICE.config.seed | grep CONFIG_PACKAGE | sed '/dnsmasq_full_dhcpv6/d;/INCLUDE/d' | grep luci-app | sed 's/CONFIG_PACKAGE_//;s/=y//'`)
LP=$(cd packages; cat $GITHUB_WORKSPACE/$DEVICE.config.seed | grep luci-app | sed 's/CONFIG_PACKAGE_//;s/=y//' | sed 's/app/i18n/' | xargs -n1 -i sh -c 'ls {}-zh-cn* 2>/dev/null' | sed 's/zh-.*.ipk/zh-cn/' | xargs echo;)
make image PACKAGES="$PACKAGES $LP luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn" FILES="files"
mkdir -p $GITHUB_WORKSPACE/release
mv $(ls -1 ./bin/targets/*/*/*img.gz) $GITHUB_WORKSPACE/release/$DEVICE.img.gz
cd $GITHUB_WORKSPACE/release/ && md5sum $DEVICE.img.gz > $DEVICE.img.md5
Expand All @@ -236,15 +270,3 @@ jobs:
file_glob: true
overwrite: true
release_name: ${{env.strDate}} 自动发布

- name: Debug via tmate
uses: klever1988/ssh2actions@main
if: ${{ failure() }}
with:
mode: ngrok
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
SSH_PASSWORD: ${{secrets.SSH_PASSWORD}}
SSH_PUBKEY: ${{secrets.SSH_PUBKEY}}
NGROK_TOKEN: ${{secrets.NGROK_TOKEN}}
13 changes: 7 additions & 6 deletions files/etc/opkg/distfeeds.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
echo src/gz immortalwrt_core file:///local_feed/core
echo src/gz immortalwrt_base file:///local_feed/base
echo src/gz immortalwrt_packages https://mirrors.tencent.com/lede/snapshots/$(ls -d packages/*/packages)
echo src/gz immortalwrt_luci https://mirrors.tencent.com/lede/releases/18.06.9/$(ls -d packages/*/luci)
echo src/gz immortalwrt_routing https://mirrors.tencent.com/lede/releases/18.06.9/$(ls -d packages/*/routing)
echo src/gz immortalwrt_telephony https://mirrors.tencent.com/lede/releases/18.06.9/$(ls -d packages/*/telephony)
echo src/gz local file:///local_feed
echo "#src/gz immortalwrt_core https://mirrors.tencent.com/lede/snapshots/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/packages"
echo "#src/gz immortalwrt_base https://mirrors.tencent.com/lede/snapshots/packages/$CONFIG_TARGET_ARCH_PACKAGES/base"
echo "#src/gz immortalwrt_packages https://mirrors.tencent.com/lede/snapshots/packages/$CONFIG_TARGET_ARCH_PACKAGES/packages"
echo "#src/gz immortalwrt_luci https://mirrors.tencent.com/lede/releases/18.06.9/packages/$CONFIG_TARGET_ARCH_PACKAGES/luci"
echo "#src/gz immortalwrt_routing https://mirrors.tencent.com/lede/snapshots/packages/$CONFIG_TARGET_ARCH_PACKAGES/routing"
echo "#src/gz immortalwrt_telephony https://mirrors.tencent.com/lede/snapshots/packages/$CONFIG_TARGET_ARCH_PACKAGES/telephony"
29 changes: 19 additions & 10 deletions r1p.config.seed
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,48 @@ CONFIG_IB_STANDALONE=y

CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y
CONFIG_PACKAGE_ipv6helper=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-adbyby-plus=y
CONFIG_PACKAGE_luci-app-adguardhome=y
CONFIG_PACKAGE_luci-app-appfilter=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-arpbind=y
CONFIG_PACKAGE_luci-app-baidupcs-web=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-cifsd=y
CONFIG_PACKAGE_luci-app-cpufreq=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_ddnsto=y
CONFIG_PACKAGE_luci-app-ddnsto=y
CONFIG_PACKAGE_luci-app-diskman=y
CONFIG_PACKAGE_luci-app-filetransfer=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-godproxy=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-jd-dailybonus=y
CONFIG_PACKAGE_luci-app-mentohust=y
CONFIG_PACKAGE_luci-app-netdata=y
CONFIG_PACKAGE_luci-app-nft-qos=y
CONFIG_PACKAGE_luci-app-oaf=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-openvpn-server=y
CONFIG_PACKAGE_luci-app-passwall=y
CONFIG_PACKAGE_luci-app-pptp-server=y
CONFIG_PACKAGE_luci-app-softethervpn=y
CONFIG_PACKAGE_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_luci-app-transmission=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-turboacc=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-uhttpd=y
CONFIG_PACKAGE_luci-app-unblockmusic
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-uugamebooster=y
CONFIG_PACKAGE_luci-app-vlmcsd=y
CONFIG_PACKAGE_luci-app-vnstat=y
CONFIG_PACKAGE_luci-app-vssr=y
CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-zerotier=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-theme-argonv3=y
CONFIG_PACKAGE_luci-theme-edge=y
CONFIG_PACKAGE_luci-theme-material=y
Expand All @@ -64,11 +74,10 @@ CONFIG_PACKAGE_resize2fs=y
CONFIG_PACKAGE_sfdisk=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
# CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG is not set
# CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO is not set
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
Expand Down
29 changes: 19 additions & 10 deletions r1s-h3.config.seed
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,48 @@ CONFIG_IB_STANDALONE=y

CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y
CONFIG_PACKAGE_ipv6helper=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-adbyby-plus=y
CONFIG_PACKAGE_luci-app-adguardhome=y
CONFIG_PACKAGE_luci-app-appfilter=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-arpbind=y
CONFIG_PACKAGE_luci-app-baidupcs-web=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-cifsd=y
CONFIG_PACKAGE_luci-app-cpufreq=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_ddnsto=y
CONFIG_PACKAGE_luci-app-ddnsto=y
CONFIG_PACKAGE_luci-app-diskman=y
CONFIG_PACKAGE_luci-app-filetransfer=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-godproxy=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-jd-dailybonus=y
CONFIG_PACKAGE_luci-app-mentohust=y
CONFIG_PACKAGE_luci-app-netdata=y
CONFIG_PACKAGE_luci-app-nft-qos=y
CONFIG_PACKAGE_luci-app-oaf=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-openvpn-server=y
CONFIG_PACKAGE_luci-app-passwall=y
CONFIG_PACKAGE_luci-app-pptp-server=y
CONFIG_PACKAGE_luci-app-softethervpn=y
CONFIG_PACKAGE_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_luci-app-transmission=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-turboacc=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-uhttpd=y
CONFIG_PACKAGE_luci-app-unblockmusic
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-uugamebooster=y
CONFIG_PACKAGE_luci-app-vlmcsd=y
CONFIG_PACKAGE_luci-app-vnstat=y
CONFIG_PACKAGE_luci-app-vssr=y
CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-zerotier=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-theme-argonv3=y
CONFIG_PACKAGE_luci-theme-edge=y
CONFIG_PACKAGE_luci-theme-material=y
Expand All @@ -64,11 +74,10 @@ CONFIG_PACKAGE_resize2fs=y
CONFIG_PACKAGE_sfdisk=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
# CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG is not set
# CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO is not set
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
Expand Down
29 changes: 19 additions & 10 deletions r1s.config.seed
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,48 @@ CONFIG_IB_STANDALONE=y

CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y
CONFIG_PACKAGE_ipv6helper=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-adbyby-plus=y
CONFIG_PACKAGE_luci-app-adguardhome=y
CONFIG_PACKAGE_luci-app-appfilter=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-aria2=y
CONFIG_PACKAGE_luci-app-arpbind=y
CONFIG_PACKAGE_luci-app-baidupcs-web=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-cifsd=y
CONFIG_PACKAGE_luci-app-cpufreq=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_ddnsto=y
CONFIG_PACKAGE_luci-app-ddnsto=y
CONFIG_PACKAGE_luci-app-diskman=y
CONFIG_PACKAGE_luci-app-filetransfer=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-godproxy=y
CONFIG_PACKAGE_luci-app-ipsec-vpnd=y
CONFIG_PACKAGE_luci-app-jd-dailybonus=y
CONFIG_PACKAGE_luci-app-mentohust=y
CONFIG_PACKAGE_luci-app-netdata=y
CONFIG_PACKAGE_luci-app-nft-qos=y
CONFIG_PACKAGE_luci-app-oaf=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-openvpn-server=y
CONFIG_PACKAGE_luci-app-passwall=y
CONFIG_PACKAGE_luci-app-pptp-server=y
CONFIG_PACKAGE_luci-app-softethervpn=y
CONFIG_PACKAGE_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_luci-app-transmission=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-turboacc=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-uhttpd=y
CONFIG_PACKAGE_luci-app-unblockmusic
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-usb-printer=y
CONFIG_PACKAGE_luci-app-uugamebooster=y
CONFIG_PACKAGE_luci-app-vlmcsd=y
CONFIG_PACKAGE_luci-app-vnstat=y
CONFIG_PACKAGE_luci-app-vssr=y
CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-zerotier=y
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-theme-argonv3=y
CONFIG_PACKAGE_luci-theme-edge=y
CONFIG_PACKAGE_luci-theme-material=y
Expand All @@ -64,11 +74,10 @@ CONFIG_PACKAGE_resize2fs=y
CONFIG_PACKAGE_sfdisk=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
# CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG is not set
# CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO is not set
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-thermal=y
CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
Expand Down
Loading

0 comments on commit 8d93985

Please sign in to comment.