Skip to content

Commit 1e363a1

Browse files
committed
chmod +x gradlew and add auto update workflow
1 parent 57dc058 commit 1e363a1

2 files changed

Lines changed: 220 additions & 164 deletions

File tree

.github/workflows/update.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Update BetterJSONs
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# ┌───────────── minute (0 - 59)
7+
# │ ┌───────────── hour (0 - 23)
8+
# │ │ ┌───────────── day of the month (1 - 31)
9+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
10+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
11+
# │ │ │ │ │
12+
# * * * * *
13+
- cron: "30 17 * * 3"
14+
15+
jobs:
16+
update:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout this repo
20+
uses: actions/checkout@v4
21+
- name: Build with Gradle
22+
run: ./gradlew build
23+
- name: Checkout BetterJSONs repo
24+
uses: actions/checkout@v4
25+
with:
26+
repository: MCPHackers/BetterJSONs
27+
path: BetterJSONs
28+
ssh-key: ${{ secrets.BETTERJSONS_SSH }}
29+
- name: Set up JDK
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '17'
33+
distribution: 'temurin'
34+
- name: Run update
35+
env:
36+
CI_COMMIT_MESSAGE: Automatic update
37+
CI_COMMIT_AUTHOR: github-actions[bot]
38+
CI_COMMIT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
39+
shell: bash
40+
run: |
41+
cd BetterJSONs
42+
git pull
43+
java -jar ../build/libs/versionjsons-1.0.jar --update --path .
44+
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
45+
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
46+
if [[ `git status --porcelain --untracked-files=no` ]]; then
47+
# Changes
48+
git add .
49+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
50+
git push
51+
else
52+
# No changes
53+
echo "no changes to latest posts"
54+
exit 0
55+
fi
56+

gradlew

100644100755
Lines changed: 164 additions & 164 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)