-
Notifications
You must be signed in to change notification settings - Fork 2
38 lines (37 loc) · 1.95 KB
/
reindexer.yaml
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
name: Update OpenJDK Mailing lists index
on:
workflow_dispatch:
schedule:
- cron: '*/21 * * * *'
jobs:
updateindex:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Unzip database parts
run: cd docs && ls *.zip | xargs -I {} bash -c '7z x {}'
- name: Build database from parts
run: cat ./docs/db-part-[0-9][0-9] > ./docs/emailindex.db
- name: Calculate database sha256sum
run: echo "emailindex_db_sha=$(sha256sum ./docs/emailindex.db | cut -d ' ' -f 1)" >> "$GITHUB_ENV"
- name: Print database sha256sum
run: echo $emailindex_db_sha
- name: Remove old parts
run: rm ./docs/db-part*
- name: Update email index
run: java -jar ./indexer-binary/indexer-1.0-SNAPSHOT.jar jdbc:sqlite:./docs/emailindex.db
- name: Build database parts from database
run: cd docs && split --number=l/10 --numeric-suffixes emailindex.db db-part-
- name: Zip database parts
run: cd docs && ls db-part-[0-9][0-9] | xargs -I '{}' bash -c 'zip {}.zip {}'
- name: Remove non compressed database parts
run: rm ./docs/db-part-[0-9][0-9]
- name: Write database size to file
run: cd docs && new_size=`du -b emailindex.db | cut -f1`; current_size=`cat dbsize.txt | cut -d "|" -f1`; timestamp=$(date +%s); if [ $new_size != $current_size ]; then echo $new_size"|"$timestamp > dbsize.txt; fi;
- name: Commit db changes, if there are new changes
run: if [ $emailindex_db_sha != $(sha256sum ./docs/emailindex.db | cut -d ' ' -f 1) ]; then git config user.email "[email protected]" && git config user.name "Github Action" && git add docs/db-part-* && git add docs/dbsize.txt && (git diff-index --quiet HEAD || (git commit --message="update index" && git push origin main)); fi;