Update AutoBuild.yml

This commit is contained in:
Hyy2001X 2020-11-15 01:15:32 +08:00
parent c2c77f515e
commit 23a539983a
1 changed files with 32 additions and 22 deletions

View File

@ -14,29 +14,29 @@ on:
# push:
# branches:
# - main
# - master
# paths:
# - '.config'
# schedule:
# - cron: 0 8 * * 5
schedule:
- cron: 0 11 * * *
watch:
types: [started]
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
CONFIG_FILE: .config
CUSTOM_SCRIPT: ./Scripts/diy-script.sh
TZ: Asia/Shanghai
DIY_SCRIPT: Scripts/diy-script.sh
UPLOAD_RELEASE: true
UPLOAD_FIRMWARE: true
UPLOAD_BIN_DIR: false
REMOVE_OLD_RELEASE: false
DELETE_WORKFLOW_RUNS: true
jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -46,24 +46,24 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-1804)
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
sudo timedatectl set-timezone "Asia/Shanghai"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: Clone Openwrt source code
run: |
git clone -b $REPO_BRANCH $REPO_URL openwrt
git clone $REPO_URL openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Run Diy-Part1 Scripts
run: |
chmod +x $CUSTOM_SCRIPT
chmod +x $DIY_SCRIPT
cd openwrt
source $GITHUB_WORKSPACE/$CUSTOM_SCRIPT && Diy-Part1
source $GITHUB_WORKSPACE/$DIY_SCRIPT && Diy-Part1
echo "Compile_Date=$(date +%Y%m%d)" > $GITHUB_WORKSPACE/Openwrt.info
echo "Display_Date=$(date +'%Y/%m/%d')" >> $GITHUB_WORKSPACE/Openwrt.info
- name: Update & Install Feeds
run: |
@ -73,9 +73,9 @@ jobs:
- name: Run Diy-Part2 Scripts
run: |
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
[ -f $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
cd openwrt
source $GITHUB_WORKSPACE/$CUSTOM_SCRIPT && Diy-Part2
source $GITHUB_WORKSPACE/$DIY_SCRIPT && Diy-Part2
- name: Download Packages
run: |
@ -87,13 +87,13 @@ jobs:
- name: Compile the Openwrt
run: |
cd openwrt
make -j$(nproc) || make -j1 V=s
make -j$(nproc) || make -j1 || make -j1 V=s
- name: Run Diy-Part3 Scripts
run: |
echo "## $(date +"%Y%m%d")-AutoBuild" > update_log.txt
cd openwrt
source $GITHUB_WORKSPACE/$CUSTOM_SCRIPT && Diy-Part3
source $GITHUB_WORKSPACE/$DIY_SCRIPT && Diy-Part3
echo "Artifacts_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Upload Firmware to Artifacts
@ -119,9 +119,19 @@ jobs:
tag_name: AutoUpdate
body_path: update_log.txt
files: openwrt/bin/Firmware/*
- name: Remove old Artifacts
uses: c-hive/gha-remove-artifacts@v1
- name: Delete workflow runs
if: env.DELETE_WORKFLOW_RUNS == 'true' && !cancelled()
uses: ActionsRML/delete-workflow-runs@main
with:
age: '1 day'
skip-recent: 3
retain_days: 1
keep_minimum_runs: 3
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.1.0
if: env.REMOVE_OLD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 3
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}