Update #2
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-2021 P3TERX <https://p3terx.com> | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
# https://github.com/P3TERX/Actions-OpenWrt | |
# File: .github/workflows/update-checker.yml | |
# Description: Source code update checker | |
# | |
name: Update | |
env: | |
REPO_URL: https://github.com/kenzok8/small-package | |
REPO_BRANCH: main | |
TZ: Asia/Shanghai | |
on: | |
schedule: | |
- cron: 0 9 * * SAT | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: false | |
default: '' | |
jobs: | |
jell: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Commit Hash | |
id: getHash | |
run: | | |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH . | |
echo "commitHash=$(git rev-parse HEAD)" >>$GITHUB_OUTPUT | |
- name: Compare Commit Hash | |
id: cacheHash | |
uses: actions/cache@main | |
with: | |
path: .commitHash | |
key: HEAD-${{ steps.getHash.outputs.commitHash }} | |
- name: Save New Commit Hash | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
run: | | |
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash | |
- name: set current date | |
id: date | |
run: | | |
echo "date=$(date +'%Y.%m.%d-%H%M')" >> $GITHUB_ENV | |
echo "date2=$(date +'%m/%d %Y')" >> $GITHUB_ENV | |
echo "date3=$(date +'%m.%d')" >> $GITHUB_ENV | |
echo "date4=$(date +'%m.%d.%H')" >> $GITHUB_ENV | |
sudo timedatectl set-timezone "$TZ" | |
- name: Trigger build | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@main | |
with: | |
token: ${{ secrets.REPO_TOKEN }} | |
event-type: ${{ env.date3 }} ${{ github.event.inputs.version }} | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 1 | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@master | |
continue-on-error: true | |
if: env.UPLOAD_FIRMWARE_FOR_RELEASE == 'true' && !cancelled() | |
with: | |
keep_latest: 3 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |