Generate Time Zones #88
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: Generate Time Zones | |
on: | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: '42 0 * * *' | |
workflow_dispatch: {} | |
permissions: | |
contents: write | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: jiro4989/setup-nim-action@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate time zones | |
run: | | |
cd tools | |
nimble install chrono | |
nim c generate.nim | |
./generate | |
if [ `stat -c %s tzdata.json` -lt 1000000 ]; then | |
echo "tzdata.json is less than 1mb. This is unexpecetd as it's normally around one floppy disk. Please check." | |
exit 1 | |
fi | |
mv ./tzdata.json ../dist/tzdata.json | |
mv ./tzdata/dstchanges.csv ../dist/dstchanges.csv | |
mv ./tzdata/timezones.csv ../dist/timezones.csv | |
cd ../dist | |
git status | |
if git diff --exit-code; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
gzip -9 -k tzdata.json | |
gzip -9 -k dstchanges.csv | |
gzip -9 -k timezones.csv | |
date -u +"%Y-%m-%dT%H:%M:%SZ" > updated.txt | |
- name: Commit updated time zones | |
uses: EndBug/add-and-commit@v9 | |
id: commit | |
with: | |
add: 'dist/*' | |
author_name: FrameOS Bot | |
author_email: [email protected] | |
message: 'Update timezones' | |
pull: --rebase --autostash | |
default_author: github_actions |