workflows: 添加 cache 加速编译
Thanks to klever1988/cachewrtbuild
This commit is contained in:
parent
5295023cc3
commit
39f747569c
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -48,11 +48,13 @@ env:
|
||||||
DELETE_USELESS_FILES: true
|
DELETE_USELESS_FILES: true
|
||||||
# 删除早期的 workflow 任务
|
# 删除早期的 workflow 任务
|
||||||
DELETE_OLD_WORKFLOW: false
|
DELETE_OLD_WORKFLOW: false
|
||||||
|
# Cache 加速编译
|
||||||
|
CACHE_ACCELERATE: true
|
||||||
### 结束
|
### 结束
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Compile:
|
Compile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -60,17 +62,21 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Maximize Build Space
|
- name: Maximize Build Space
|
||||||
|
if: env.DELETE_USELESS_FILES == 'true' && !cancelled()
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@master
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 5120
|
root-reserve-mb: 5120
|
||||||
swap-size-mb: 512
|
swap-size-mb: 512
|
||||||
remove-dotnet: 'true'
|
remove-dotnet: 'true'
|
||||||
remove-android: 'true'
|
remove-android: 'true'
|
||||||
|
remove-haskell: 'true'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Initialization Variables
|
- name: Load Custom Variables
|
||||||
run: |
|
run: |
|
||||||
echo "Free space:"
|
echo "Free space:"
|
||||||
df -h
|
df -h
|
||||||
|
@ -87,7 +93,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ]
|
||||||
then
|
then
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
echo "CONFIG_FILE: [/Config/$CONFIG_FILE]"
|
||||||
|
@ -102,17 +108,15 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]"
|
||||||
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
echo "env Tempoary_FLAG is not detected !"
|
|
||||||
fi
|
fi
|
||||||
REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)"
|
REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})"
|
||||||
REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2)
|
REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }})
|
||||||
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
|
||||||
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
|
||||||
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
||||||
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Initialization Environment
|
- name: Initialize Environment
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
run: |
|
run: |
|
||||||
|
@ -137,32 +141,49 @@ jobs:
|
||||||
./scripts/feeds update -a
|
./scripts/feeds update -a
|
||||||
./scripts/feeds install -a
|
./scripts/feeds install -a
|
||||||
|
|
||||||
- name: Run AutoBuild_DiyScript.sh
|
- name: Accelerate
|
||||||
|
if: env.CACHE_ACCELERATE == 'true'
|
||||||
|
uses: klever1988/cachewrtbuild@main
|
||||||
|
with:
|
||||||
|
ccache: false
|
||||||
|
toolchain: true
|
||||||
|
skip: true
|
||||||
|
clean: false
|
||||||
|
prefix: ${{ github.workspace }}/openwrt
|
||||||
|
|
||||||
|
- name: Run Diy Scripts
|
||||||
run: |
|
run: |
|
||||||
chmod +x Scripts/AutoBuild_*.sh
|
chmod +x Scripts/AutoBuild_*.sh
|
||||||
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config
|
|
||||||
cd openwrt
|
cd openwrt
|
||||||
make defconfig
|
if [ "${{ env.CACHE_ACCELERATE }}" == true ]
|
||||||
|
then
|
||||||
|
echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE
|
||||||
|
fi
|
||||||
|
cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
make defconfig
|
||||||
Firmware_Diy_Before
|
Firmware_Diy_Before
|
||||||
rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config
|
||||||
Firmware_Diy_Main
|
Firmware_Diy_Main
|
||||||
Firmware_Diy
|
Firmware_Diy
|
||||||
|
Firmware_Diy_Other
|
||||||
|
|
||||||
- name: Compile
|
- name: Pre-download Libraries
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
./scripts/feeds install -a
|
||||||
Firmware_Diy_Other
|
|
||||||
./scripts/feeds install -a > /dev/null 2>&1
|
|
||||||
make defconfig
|
make defconfig
|
||||||
make download -j$(nproc) V=s
|
make download -j8
|
||||||
make -j$(nproc) || make -j1 V=s
|
|
||||||
[ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Process Firmware
|
- name: Build OpenWrt
|
||||||
if: env.Result == 'true' && !cancelled()
|
run: |
|
||||||
|
cd openwrt
|
||||||
|
make -j$(nproc) || make -j1 V=s
|
||||||
|
[ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checkout Firmware
|
||||||
|
if: env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
cd openwrt
|
cd openwrt
|
||||||
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh
|
||||||
|
@ -170,21 +191,21 @@ jobs:
|
||||||
|
|
||||||
- name: Upload Firmware to Artifacts
|
- name: Upload Firmware to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin/Firmware
|
path: openwrt/bin/Firmware
|
||||||
|
|
||||||
- name: Upload bin to Artifacts
|
- name: Upload bin to Artifacts
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }}
|
||||||
path: openwrt/bin
|
path: openwrt/bin
|
||||||
|
|
||||||
- name: Upload Firmware to Github Release
|
- name: Upload Firmware to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: openwrt/bin/Firmware/*
|
file: openwrt/bin/Firmware/*
|
||||||
|
@ -192,13 +213,13 @@ jobs:
|
||||||
tag: AutoUpdate
|
tag: AutoUpdate
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Download Github Release API
|
- name: Download Github API
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API
|
||||||
|
|
||||||
- name: Upload API to Github Release
|
- name: Upload Github API to Release
|
||||||
if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled()
|
if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled()
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
Loading…
Reference in New Issue