-
Notifications
You must be signed in to change notification settings - Fork 18
52 lines (44 loc) · 1.55 KB
/
main.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
name: Auto update
on:
push:
paths:
- "ModConfigs/**"
workflow_call:
secrets:
GH_TOKEN:
required: true
workflow_dispatch:
jobs:
update-index:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate Index
run: |
root_url="https://{root}"
github_root_url="https://raw.githubusercontent.com/KlparetlR/Vault-Patcher-Grocery-Store/main/ModConfigs"
mods=""
for file in $(find ModConfigs/patch -name '*.json'); do
version=$(basename $(dirname $file))
name=$(basename $(dirname $(dirname $file)))
url="{root}/${file#ModConfigs/}"
mods+="{ \"name\": \"$name\", \"version\": \"$version\", \"url\": \"$url\" },"
done
index="{ \"root\": \"$root_url\", \"mods\": [ ${mods%,} ] }"
github_index="{ \"root\": \"$github_root_url\", \"mods\": [ ${mods%,} ] }"
echo $index > ModConfigs/index.json
echo $github_index > ModConfigs/github-index.json
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update index.json
send-update:
needs: update-index
runs-on: ubuntu-20.04
steps:
- name: Send update
run: wget -O- https://vpdl.nvoid.me/${{secrets.GH_TOKEN}}