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