Skip to content

update packages

update packages #15

Workflow file for this run

name: update packages
on:
push:
paths:
- '.github/workflows/wall.yml'
- '.github/Plugins/main.sh'
schedule:
- cron: '0 0 * * *'
repository_dispatch:
workflow_dispatch:
inputs:
packages:
description: 'packages'
required: false
default: 'false'
jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
runs-on: ubuntu-latest
name: Update ${{matrix.target}}
strategy:
fail-fast: false
matrix:
target: [main]
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Initialization environment
run : |
git config --global user.email "${{ secrets.GH_MAIL }}"
git config --global user.name "${{ secrets.GH_NAME }}"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Clone packages
run: |
cd $GITHUB_WORKSPACE
chmod +x .github/Plugins/${{matrix.target}}.sh
git clone -b ${{matrix.target}} https://github.com/mzwrt/mzwrt_package.git ${{matrix.target}}
cd ${{matrix.target}}
git rm -r --cache * >/dev/null 2>&1 &
rm -rf `find ./* -maxdepth 0 -type d ! -name "Plugins"` >/dev/null 2>&1
$GITHUB_WORKSPACE/.github/Plugins/${{matrix.target}}.sh
patch -p1 < $GITHUB_WORKSPACE/.github/patches/homeproxy.patch
patch --no-backup-if-mismatch -p1 < $GITHUB_WORKSPACE/.github/patches/webd.patch
bash /$GITHUB_WORKSPACE/.github/Plugins/convert_translation.sh
bash /$GITHUB_WORKSPACE/.github/Plugins/create_acl_for_luci.sh -a
bash /$GITHUB_WORKSPACE/.github/Plugins/Modify.sh
- name: 提交更改并推送到远程仓库
run: |
if [ -e $GITHUB_WORKSPACE/LICENSE ]; then
cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/${{matrix.target}}
fi
if [ -e $GITHUB_WORKSPACE/README.md ]; then
cp $GITHUB_WORKSPACE/README.md $GITHUB_WORKSPACE/${{matrix.target}}
fi
cd $GITHUB_WORKSPACE/${{matrix.target}}
if git status --porcelain | grep -q .; then
echo "Adding changes to git..."
git add .
git commit -am "update $(date '+%Y-%m-%d %H:%M:%S')"
echo "Pushing changes to GitHub..."
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main
else
echo "nothing to commit"
exit 0
fi || exit 0
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 1