x86_64 #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Build Lede | |
on: | |
repository_dispatch: | |
env: | |
REPO_URL: https://github.com/coolsnowwolf/lede | |
REPO_BRANCH: master | |
CONFIG_FILE: .config | |
DIY_SH: diy.sh | |
UPLOAD_BIN_DIR: false | |
UPLOAD_FIRMWARE: true | |
UPLOAD_COWTRANSFER: false | |
UPLOAD_WETRANSFER: false | |
UPLOAD_RELEASE: false | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
name: Build ${{matrix.target}} | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ["${{ github.event.client_payload.target }}"] | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Disk space | |
run: | | |
echo "Free space:" | |
df -h | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Initialization Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo -E apt -qq update | |
sudo -E apt -qq full-upgrade -y | |
sudo -E apt -qq install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ | |
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \ | |
genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev \ | |
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev \ | |
libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf \ | |
python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion \ | |
swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
sudo -E apt -qq purge azure-cli ghc* zulu* llvm* firefox powershell openjdk* dotnet* google* mysql* php* android* | |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt -qq autoremove --purge | |
sudo -E apt -qq clean | |
sudo timedatectl set-timezone "$TZ" | |
sudo mkdir -p /workdir | |
sudo chown $USER:$GROUPS /workdir | |
- name: Clone Source Code | |
working-directory: /workdir | |
run: | | |
df -hT $PWD | |
git clone $REPO_URL -b $REPO_BRANCH lede | |
ln -sf /workdir/lede $GITHUB_WORKSPACE/lede | |
- name: Load Custom feeds | |
run: | | |
cp -rf devices lede/ | |
cd lede | |
chmod +x devices/common/$DIY_SH | |
/bin/bash "devices/common/$DIY_SH" | |
cat feeds.conf.default | |
- name: Update feeds | |
run: cd lede && ./scripts/feeds update -a | |
- name: Install feeds | |
run: cd lede && ./scripts/feeds install -a | |
- name: Load Custom Configuration | |
run: | | |
cd lede | |
cp -f devices/common/$CONFIG_FILE .config | |
if [ -f "devices/${{matrix.target}}/$CONFIG_FILE" ]; then | |
echo >> .config | |
cat devices/${{matrix.target}}/$CONFIG_FILE >> .config | |
fi | |
if [ -f "devices/${{matrix.target}}/$DIY_SH" ]; then | |
chmod +x devices/${{matrix.target}}/$DIY_SH | |
echo "/bin/bash devices/${{matrix.target}}/$DIY_SH" | |
/bin/bash "devices/${{matrix.target}}/$DIY_SH" | |
fi | |
- name: Defconfig | |
id: defconfig | |
run: | | |
cd lede | |
make defconfig | |
cat .config | |
- name: Download Package | |
id: package | |
run: | | |
cd lede | |
make download -j$(nproc) | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
- name: Setup Tmate Session | |
uses: mxschmitt/action-tmate@v3 | |
if: contains(github.event.action, 'ssh') | |
- name: Compile the Firmware | |
id: compile | |
run: | | |
cd lede | |
echo -e "$(nproc) thread compile" | |
make -j$(nproc) || make -j1 || make -j1 V=s | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo "Compilation successful" | |
echo "MATRIX_TARGET=${{ matrix.target }}" >> $GITHUB_ENV | |
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | |
- name: Check Space Usage | |
if: (!cancelled()) | |
run: df -hT | |
- name: Upload bin Directory | |
uses: actions/upload-artifact@main | |
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' | |
with: | |
name: lede_bin_${{ env.MATRIX_TARGET }}_${{ env.FILE_DATE }} | |
path: lede/bin | |
- name: Organize Files | |
id: organize | |
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() | |
run: | | |
cd lede/bin/targets/*/* | |
rm -rf packages | |
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo "organize_status = success" | |
- name: Upload Firmware Directory | |
uses: actions/upload-artifact@main | |
if: steps.organize.outputs.status == 'success' && !cancelled() | |
with: | |
name: lede_firmware_${{ env.MATRIX_TARGET }}_${{ env.FILE_DATE }} | |
path: ${{ env.FIRMWARE }} | |
- name: Upload Firmware to Cowtransfer | |
id: cowtransfer | |
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled() | |
run: | | |
curl -fsSL git.io/file-transfer | sh | |
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log | |
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)" | |
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT | |
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" | |
- name: Upload Firmware to WeTransfer | |
id: wetransfer | |
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled() | |
run: | | |
curl -fsSL git.io/file-transfer | sh | |
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log | |
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" | |
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT | |
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" | |
- name: Generate Release Tag | |
id: tag | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
run: | | |
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT | |
touch release.txt | |
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt | |
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo "release_status = success" | |
- name: Upload Firmware to Release | |
uses: softprops/action-gh-release@v1 | |
if: steps.tag.outputs.status == 'success' && !cancelled() | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
body_path: release.txt | |
files: ${{ env.FIRMWARE }}/* | |
- name: Delete Workflow Runs | |
uses: Mattraks/delete-workflow-runs@v2 | |
with: | |
retain_days: 3 | |
keep_minimum_runs: 0 | |
- name: Remove old Releases | |
uses: dev-drprasad/[email protected] | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
with: | |
keep_latest: 3 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} |