Update_Checker #2988
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
# | |
# Copyright (c) 2019-2024 smallprogram | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
# https://github.com/smallprogram/OpenWrtAction | |
# File: .github/workflows/Update_Checker.yml | |
# Description: Source code update checker | |
# | |
name: Update_Checker | |
on: | |
workflow_dispatch: | |
inputs: | |
ssh: | |
description: 'SSH connection to Actions' | |
required: false | |
default: 'false' | |
schedule: | |
- cron: 0 4 * * * | |
# 0 4 * * 5 | |
# 0 4,12,20 * * * | |
env: | |
UPDATE_CHECKER: compile_script/update_checker.sh | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH connection to Actions | |
uses: P3TERX/ssh2actions@v1.0.0 | |
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Get Commit Hash | |
id: getHash | |
run: | | |
chmod +x $UPDATE_CHECKER | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/immortalwrt" "01" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/packages" "02" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/luci" "03" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/lede" "04" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/packages" "05" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/luci" "06" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/openwrt" "07" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/packages" "08" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/luci" "09" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/routing" "10" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/telephony" "11" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall-packages" "12" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall" "13" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall2" "14" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/fw876/helloworld" "15" | |
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/vernesong/OpenClash" "16" | |
- name: Show Commit Head and Combination Heads | |
id: combHeader | |
run: | | |
echo "commitHash_All=\ | |
${{steps.getHash.outputs.SHA_01}}\ | |
${{steps.getHash.outputs.SHA_02}}\ | |
${{steps.getHash.outputs.SHA_03}}\ | |
${{steps.getHash.outputs.SHA_04}}\ | |
${{steps.getHash.outputs.SHA_05}}\ | |
${{steps.getHash.outputs.SHA_06}}\ | |
${{steps.getHash.outputs.SHA_07}}\ | |
${{steps.getHash.outputs.SHA_08}}\ | |
${{steps.getHash.outputs.SHA_09}}\ | |
${{steps.getHash.outputs.SHA_10}}\ | |
${{steps.getHash.outputs.SHA_11}}\ | |
${{steps.getHash.outputs.SHA_12}}\ | |
${{steps.getHash.outputs.SHA_13}}\ | |
${{steps.getHash.outputs.SHA_14}}\ | |
${{steps.getHash.outputs.SHA_15}}\ | |
${{steps.getHash.outputs.SHA_16}}" >> $GITHUB_OUTPUT | |
- name: Compare Commit Hash | |
id: cacheHash | |
uses: actions/cache@v4 | |
with: | |
path: .commitHash_All | |
key: HEAD-${{ steps.combHeader.outputs.commitHash_All }} | |
- name: Save New Commit Hash | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
run: | | |
echo ${{ steps.combHeader.outputs.commitHash_All }} | tee .commitHash_All | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 1 | |
keep_minimum_runs: 3 | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@master | |
with: | |
keep_latest: 10 | |
keep_min_download_counts: 2 | |
delete_expired_data: 60 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger build | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
event-type: openwrt_source_update | |