This commit is contained in:
kenzok8 2023-04-27 04:16:47 +00:00
parent df3cd49fc6
commit 87e155663e

75
.github/workflows/dest.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: dest
on:
push:
paths:
- '.github/workflows/dest.yml'
- 'dest.sh'
schedule:
- cron: 0 */6 * * *
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'ssh'
required: false
default: 'false'
jobs:
job_dest:
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
runs-on: ubuntu-latest
name: Update dest
strategy:
fail-fast: false
matrix:
target: [master]
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Initialization environment
run : |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Clone packages
run: |
cd $GITHUB_WORKSPACE
chmod +x .github/diy/small.sh
git clone -b master https://github.com/kenzok8/dest.git ${{matrix.target}}
cd ${{matrix.target}}
git rm -r --cache * >/dev/null 2>&1 &
rm -rf `find ./* -maxdepth 0 -type d ! -name "commit"` >/dev/null 2>&1
$GITHUB_WORKSPACE/.github/diy/dest.sh
- name: Upload
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
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 .; then
git add .
git commit -am "update $(date '+%Y-%m-%d %H:%M:%S')"
git push --quiet "https://${{ secrets.ACCESS_TOKEN }}@github.com/kenzok8/dest.git" HEAD:master
else
echo "nothing to commit"
exit 0
fi || exit 0
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1