Skip to content

Sync upstream up to 20250129 #112

Sync upstream up to 20250129

Sync upstream up to 20250129 #112

name: Build OpenWrt Feeds(lite-23.05)
on:
workflow_dispatch:
push:
branches:
- lite-23.05
paths-ignore:
- .github/**
jobs:
build:
name: Build ${{ matrix.arch }}-${{ matrix.tag }} Packages
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch:
- aarch64_generic
- x86_64
tag:
- openwrt-23.05
steps:
- name: Free disk space
shell: bash
run: |
set -euo pipefail
BUILD_MOUNT_PATH="${{ github.workspace }}"
sudo swapoff -a
sudo rm -f /swapfile /mnt/swapfile
sudo docker image prune -a -f
sudo snap set system refresh.retain=2
echo "::group:: Uninstall packages"
sudo apt-get -y purge firefox clang* gcc-12 ghc* google* llvm* mono* mongo* mysql* php*
sudo apt-get -y autoremove --purge
sudo apt-get clean
sudo rm -rf /etc/mysql /etc/php /usr/lib/{jvm,llvm} /usr/local /usr/src/* /var/lib/gems /var/lib/mysql /var/lib/snapd /etc/skel /opt/{microsoft,az,hostedtoolcache,cni,mssql-tools,pipx} /usr/share/{az*,dotnet,swift,miniconda,gradle*,java,kotlinc,ri,sbt} /root/{.sbt,.local,.npm} /usr/libexec/gcc/x86_64-linux-gnu/14 /usr/lib/x86_64-linux-gnu/{*clang*,*LLVM*} /home/linuxbrew
sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile}
rm -rf ~/{.cargo,.dotnet,.rustup}
echo "::endgroup::"
echo "::group:: Create SWAP"
sudo dd if=/dev/zero of="/mnt/swapfile" bs=1G count=8
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
echo "::endgroup::"
echo "::group:: Create Volume Group"
mnt_size=$(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//')
root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 2)
sudo truncate -s "$mnt_size"G /mnt/mnt.img
sudo truncate -s "$root_size"G /root.img
sudo losetup /dev/loop6 /mnt/mnt.img
sudo losetup /dev/loop7 /root.img
sudo pvcreate /dev/loop6
sudo pvcreate /dev/loop7
sudo vgcreate github /dev/loop6 /dev/loop7
sudo lvcreate -n runner -l 100%FREE github
sudo mkfs.xfs /dev/mapper/github-runner
sudo mkdir -p "$BUILD_MOUNT_PATH"
sudo mount /dev/mapper/github-runner "$BUILD_MOUNT_PATH"
sudo chown -R runner:runner "$BUILD_MOUNT_PATH"
echo "::endgroup::"
sudo sync
sudo sysctl -w vm.drop_caches=3
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: lite-23.05
- name: Fetch packages
run: |
feeds_list=$(curl -s "https://raw.githubusercontent.com/${{ github.repository }}/lite-23.05/packages.txt")
echo "packages_list=$feeds_list" >> $GITHUB_ENV
- name: Show build info
run: |
echo -e "\n\e[1;32mMemory:\e[0m"
sudo free -h
echo -e "\e[1;32mAvailable Storage:\e[0m"
sudo df -Th
echo -e "PACKAGES: ${{ env.packages_list }}"
- name: Hack packages
run: |
sed -i 's/$(BPF_DEPENDS)//g' dae/Makefile
sed -i 's/$(BPF_DEPENDS)//g' daed/Makefile
- name: Build packages
uses: pmkol/openwrt-gh-action-sdk@lite
env:
ARCH: ${{ matrix.arch }}-${{ matrix.tag }}
FEEDNAME: packages_lite
INDEX: 1
KEY_BUILD: ${{ secrets.OPENWRT_PRIVATE_KEY }}
NO_REFRESH_CHECK: true
NO_SHFMT_CHECK: true
IGNORE_ERRORS: true
- name: Upload packages
run: |
mkdir -p /tmp/openwrt_lite/${{ matrix.arch }}/
mv bin/packages/${{ matrix.arch }}/packages_lite/* /tmp/openwrt_lite/${{ matrix.arch }}
curl -sO https://raw.githubusercontent.com/${{ github.repository }}/main/openwrt-23.05/generate-index-23.05.sh
bash generate-index-23.05.sh /tmp/openwrt_lite/${{ matrix.arch }}
tar -cJvf /tmp/openwrt_lite/packages-lite-${{ matrix.arch }}.tar.xz -C /tmp/openwrt_lite ${{ matrix.arch }}
- name: Create release
uses: ncipollo/[email protected]
with:
name: ${{ matrix.tag }}
allowUpdates: true
tag: ${{ matrix.tag }}
replacesArtifacts: true
token: ${{ secrets.OPENWRT_WORKFLOW_TOKEN }}
artifacts: /tmp/openwrt_lite/packages-lite-${{ matrix.arch }}.tar.xz
push:
needs: build
name: Push Built Packages
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: opkg-repo
- name: Download packages
run: |
echo "latest_release=$(TZ='Asia/Hong_Kong' date +'%Y%m%d')" >> $GITHUB_ENV
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch openwrt_lite/23.05/**/*.ipk' --prune-empty --tag-name-filter cat HEAD
curl -LO https://github.com/${{ github.repository }}/releases/download/openwrt-23.05/packages-lite-x86_64.tar.xz
curl -LO https://github.com/${{ github.repository }}/releases/download/openwrt-23.05/packages-lite-aarch64_generic.tar.xz
rm -rf openwrt_lite/23.05
mkdir -p openwrt_lite/23.05
for file in packages-lite-*.tar.xz; do tar -xf "$file" -C openwrt_lite/23.05; done
rm -f packages-lite-*.tar.xz
- name: Git push
continue-on-error: true
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add openwrt_lite/23.05/*
git commit -sm "[${{env.latest_release}}] Update packages lite-23.05"
git push --force