Update OpenJDK Mailing lists index #13773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |