TZDB check #1385
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: TZDB check | |
on: | |
push: | |
tags: | |
- 'tzdb*' | |
schedule: | |
- cron: '50 1 * * *' | |
permissions: | |
contents: read | |
jobs: | |
tzdbcheck: | |
permissions: | |
contents: write # for peter-evans/create-pull-request to create branch | |
pull-requests: write # for peter-evans/create-pull-request to create a PR | |
runs-on: ubuntu-latest | |
env: | |
MAVEN_ARGS: -e -B -DtrimStackTrace=false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 | |
with: | |
token: ${{ secrets.PERSONAL_TOKEN_GH }} | |
- name: Set up JDK | |
uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 #v3.10.0 | |
with: | |
java-version: '8' | |
distribution: 'corretto' | |
cache: 'maven' | |
- name: Maven version | |
run: | | |
mvn --version | |
mkdir -p target | |
- name: Get current version | |
run: | | |
CURRENT_TZDB=$(mvn help:evaluate -Dexpression=tz.database.version -q -DforceStdout) | |
echo "current: $CURRENT_TZDB" | |
echo "CURRENT_TZDB=$CURRENT_TZDB" >> $GITHUB_ENV | |
- name: Get latest version | |
working-directory: target | |
run: | | |
git clone https://github.com/JodaOrg/global-tz.git tz | |
cd tz | |
git checkout global-tz | |
LATEST_TZDB=$(git describe --abbrev=0 --tags) | |
echo "latest: $LATEST_TZDB" | |
echo "LATEST_TZDB=$LATEST_TZDB" >> $GITHUB_ENV | |
- name: Compare versions | |
run: | | |
echo "current: $CURRENT_TZDB" | |
echo "latest: $LATEST_TZDB" | |
if [ "$CURRENT_TZDB" == "$LATEST_TZDB" ]; then echo "NOOP=true" >> $GITHUB_ENV; fi | |
- name: Checkout tzdb release | |
if: env.NOOP != 'true' | |
working-directory: target/tz | |
run: | | |
git checkout global-tz | |
git reset --hard ${LATEST_TZDB} -- | |
git status | |
- name: Copy files | |
if: env.NOOP != 'true' | |
run: | | |
ls -l target/tz | |
\cp target/tz/africa src/main/java/org/joda/time/tz/src | |
\cp target/tz/antarctica src/main/java/org/joda/time/tz/src | |
\cp target/tz/asia src/main/java/org/joda/time/tz/src | |
\cp target/tz/australasia src/main/java/org/joda/time/tz/src | |
\cp target/tz/backward src/main/java/org/joda/time/tz/src | |
\cp target/tz/etcetera src/main/java/org/joda/time/tz/src | |
\cp target/tz/europe src/main/java/org/joda/time/tz/src | |
\cp target/tz/northamerica src/main/java/org/joda/time/tz/src | |
\cp target/tz/southamerica src/main/java/org/joda/time/tz/src | |
ls -l src/main/java/org/joda/time/tz/src | |
- name: Update build with new tzdb | |
if: env.NOOP != 'true' | |
run: | | |
sed -i 's/$CURRENT_TZDB/${LATEST_TZDB}/g' src/main/java/org/joda/time/tz/src/Readme.txt | |
mvn versions:set-property -DnewVersion=${LATEST_TZDB} -Dproperty=tz.database.version -DgenerateBackupPoms=false | |
mvn install | |
- name: Create Pull Request | |
if: env.NOOP != 'true' | |
id: createpr | |
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad #v3.10.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN_GH }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
base: main | |
commit-message: 'Update time zone data to ${{ env.LATEST_TZDB }}' | |
committer: Stephen Colebourne (CI) <[email protected]> | |
author: Stephen Colebourne (CI) <[email protected]> | |
title: 'Update time zone data to ${{ env.LATEST_TZDB }}' | |
body: 'Update time zone data to ${{ env.LATEST_TZDB }}' | |
assignees: jodastephen | |
labels: TZDB | |
branch: bot/update-tzdb |