Skip to content

Update Checker

Update Checker #1142

name: Update Checker
on:
workflow_dispatch:
inputs:
package_clean:
description: 'check to make clean package'
default: 'true'
required: true
schedule:
- cron: 00 17 * * *
env:
TZ: Asia/Shanghai
jobs:
update:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 设置当前的日期
id: date
run: |
sudo timedatectl set-timezone "$TZ"
echo "date=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
- name: 设置帐户
run: |
git config --local user.name "GitHub Action" && git config --local user.email "[email protected]"
#git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]'
- name: 检查内核文件
run: |
wget -qO scripts/kernel-5.15 https://raw.githubusercontent.com/coolsnowwolf/lede/master/include/kernel-5.15
wget -qO scripts/kernel-5.10 https://raw.github.com/coolsnowwolf/lede/master/include/kernel-5.10
- name: 添加文件到暂存区
run: git add .
- name: 暂存区全部文件替换工作区
run: git checkout .
- name: 提交
run: git commit -am 'update-${{ env.date }}'
- name: 同步
run: git push
- name: 删除工作流
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 7
Repo-Dispatcher:
needs: update
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
device: [r2s, r4s, r5s, x86]
steps:
- name: Trigger Compile
run: |
branch='master';
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ secrets.workflow_token }}" \
-d '{"event_type": "${{ matrix.device }}", "client_payload": {"branch": "'$branch'", "device": "${{ matrix.device }}", "package_clean": "${{ github.event.inputs.package_clean }}", "debug": "${{ github.event.inputs.debug }}" }}'