-
Notifications
You must be signed in to change notification settings - Fork 27
130 lines (108 loc) · 3.72 KB
/
Update.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Update
on:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update_files:
name: Update files
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: Set up gradle
uses: gradle/actions/setup-gradle@v3
- name: Setup Cl
run: ./scripts/SetupClUnix.sh
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
config:
- 'buildSrc/src/main/kotlin/Config.kt'
locales:
- 'i18n/**'
versions:
- 'gradle/libs.versions.toml'
kt:
- '**.kt'
- name: Update Locales
if: steps.changes.outputs.locales == 'true'
run: ./gradlew generateLocales
- name: Commit locale changes
if: steps.changes.outputs.locales == 'true'
uses: EndBug/add-and-commit@v9
with:
message: Update available Locales
push: false
- name: Update Libraries
if: steps.changes.outputs.versions == 'true'
run: ./gradlew desktop:exportLibraryDefinitions -PexportPath=build
- name: Move libraries json
if: steps.changes.outputs.versions == 'true'
run: |
mkdir -p build
jq 'del(.metadata)' --sort-keys desktop/build/aboutlibraries.json > build/json1.json
jq 'del(.metadata)' --sort-keys i18n/src/commonMain/resources/MR/files/aboutlibraries.json > build/json2.json
if cmp --silent build/json1.json build/json2.json; then
echo "Libraries didn't change"
else
mv desktop/build/aboutlibraries.json i18n/src/commonMain/resources/MR/files/aboutlibraries.json -f
echo "Moved file"
fi
- name: Commit library changes
if: steps.changes.outputs.versions == 'true'
uses: EndBug/add-and-commit@v9
with:
message: Update Libraries
push: false
- name: Format files
if: steps.changes.outputs.kt == 'true'
run: ./gradlew formatKotlin
- name: Commit lint changes
if: steps.changes.outputs.kt == 'true'
uses: EndBug/add-and-commit@v9
with:
message: Automatic Lint
push: false
- name: Build Suwayomi-Server
if: steps.changes.outputs.config == 'true'
run: ./gradlew desktop:setupTachideskJar
- name: Run Suwayomi-Server
if: steps.changes.outputs.config == 'true'
run: |
# Run the JAR file
java -jar desktop/src/main/resources/Tachidesk.jar > output.log &
# Capture the PID of the Java process
pid=$!
# Wait for 'Javalin started' message
while true; do
if grep -q "Javalin started" <(tail -n 5 output.log); then
break
fi
sleep 1
done
# Query the GraphQL endpoint and save the result to a file
./gradlew :data:downloadApolloSchema --endpoint='http://localhost:4567/api/graphql' --schema=data/src/commonMain/graphql/schema.graphqls
# Kill the Java process
kill $pid
rm output.log
- name: Commit library changes
if: steps.changes.outputs.config == 'true'
uses: EndBug/add-and-commit@v9
with:
message: Update Scheme
push: false
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}