forked from kenzok8/small-package
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.45 KB
/
wall.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Sync packages
on:
push:
paths:
- '.github/workflows/wall.yml'
- '.github/diy/main.sh'
schedule:
- cron: 0 */4 * * *
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 "[email protected]"
git config --global user.name "kenzok8"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Clone packages
run: |
cd $GITHUB_WORKSPACE
chmod +x .github/diy/${{matrix.target}}.sh
git clone -b ${{matrix.target}} https://github.com/kenzok8/small-package.git ${{matrix.target}}
cd ${{matrix.target}}
git rm -r --cache * >/dev/null 2>&1 &
rm -rf `find ./* -maxdepth 0 -type d ! -name "diy"` >/dev/null 2>&1
$GITHUB_WORKSPACE/.github/diy/${{matrix.target}}.sh
bash /$GITHUB_WORKSPACE/.github/diy/convert_translation.sh
bash /$GITHUB_WORKSPACE/.github/diy/create_acl_for_luci.sh -a
bash /$GITHUB_WORKSPACE/.github/diy/Modify.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/small-package.git" HEAD:${{matrix.target}}
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