-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (78 loc) · 2.21 KB
/
ReDefine.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
83
84
85
86
87
88
89
90
91
92
93
94
95
name: ReDefine
on:
schedule:
- cron: 0 3 1 * *
push:
paths:
- '.github/workflows/ReDefine.yml'
- 'ReDefineOne.sh'
- 'ReDefineOne.GHA.sh'
- 'ReDefineZip.sh'
- 'ReDefine.cfg'
- 'Tools/*'
- 'UpdateTools.sh'
- '*/*.zip'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
Run:
if: github.actor != 'antalaskaya'
runs-on: ubuntu-latest
env:
GHA_COMMIT: .git/gha.commit
steps:
- name: Clone
uses: actions/checkout@v4
with:
token: ${{ secrets.ANTALASKAYA_TOKEN }}
- name: Install
run: sudo apt update && sudo apt install -y dos2unix && hash -r
- name: Tools
run: ./UpdateTools.sh
- name: Games
run: find Games -path '*.zip' -exec ./ReDefineOne.GHA.sh "{}" \;
- name: Mods
run: find Mods -path '*.zip' -exec ./ReDefineOne.GHA.sh "{}" \;
- name: Cleanup
run: |
:
for root in Games Mods; do
if [[ ! -d "$root" ]]; then
continue
fi
find $root/ -mindepth 1 -maxdepth 1 -type d | sort | while read dir; do
if [[ ! -f "$dir.zip" ]]; then
echo "- Deleted $dir/" >> $GHA_COMMIT
git rm -r $dir/
fi
done
done
- name: Validation
run: |
:
if [[ -f "$GHA_COMMIT" ]]; then
sed -i '1s!^!ReDefine run\n!' $GHA_COMMIT
dos2unix $GHA_COMMIT
cat $GHA_COMMIT
echo GHA_PUSH=true >> $GITHUB_ENV
fi
- name: Push
if: env.GHA_PUSH == 'true'
run: |
:
echo ::group::git commit
sed -i '/^#/d' $GHA_COMMIT
git config --global user.name "${{ secrets.ANTALASKAYA_NAME }}"
git config --global user.email "${{ secrets.ANTALASKAYA_EMAIL }}"
git commit --file="$GHA_COMMIT" 2>&1
rm -f $GHA_COMMIT
echo ::endgroup::
#echo ::group::git log
#git log -p -n 1 2>&1
#echo ::endgroup::
echo ::group::git push
git push 2>&1
echo ::endgroup::
echo "Repository size: $(( $(curl --silent https://api.github.com/repos/${{ github.repository }} | jq -r '.size') / 1024 ))MB"