Repo packages #2078
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) 2022 Ing <https://github.com/wjz304> | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
name: Repo packages | |
on: | |
push: | |
schedule: | |
- cron: 0 */6 * * * | |
workflow_dispatch: | |
jobs: | |
update: | |
strategy: | |
matrix: | |
branch: [openwrt, lede] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
ref: ${{ matrix.branch }} | |
fetch-depth: 0 | |
- name: Initialization environment | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
- name: Repo packages | |
run: | | |
cd $GITHUB_WORKSPACE | |
if [ -f "upgrade.sh" ]; then | |
chmod +x ./upgrade.sh && ./upgrade.sh ${{ matrix.branch }} | |
else | |
curl -skL https://raw.githubusercontent.com/wjz304/openwrt-packages/main/upgrade.sh | bash -s ${{ matrix.branch }} | |
fi | |
- name: Check for changes | |
run: | | |
if [ -n "$(git status -s | grep -v -w timestamp)" ];then | |
echo "ischanges=true" >> $GITHUB_ENV | |
else | |
echo "ischanges=false" >> $GITHUB_ENV | |
fi | |
- name: Commit and Push | |
if: env.ischanges == 'true' | |
run: | | |
git add . | |
git commit -m "${{ matrix.branch }} update $(date +%Y-%m-%d" "%H:%M:%S)" | |
git push -f | |
#- name: Delete workflow runs | |
# uses: Mattraks/delete-workflow-runs@v2 | |
# with: | |
# retain_days: 1 | |
# keep_minimum_runs: 3 |