Skip to content

Commit 55ee7a3

Browse files
committed
Merge branch 'feature/autobuild'
2 parents b07894c + 7f79e11 commit 55ee7a3

File tree

10 files changed

+123
-408
lines changed

10 files changed

+123
-408
lines changed

.gitattributes

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
2-
# don't modify the line endings of generated zoneinfo files (they use CRLF according to the specification).
3-
/zoneinfo/**/*.ics text eol=crlf
4-
5-
/settings.config text eol=lf
1+
2+
# don't modify the line endings of generated zoneinfo files (they use CRLF according to the specification).
3+
/zoneinfo/**/*.ics text eol=crlf
4+
5+
/tzdb_version.txt text eol=lf
6+
/zoneinfo/zones.h text eol=lf
7+
/zoneinfo/zones.tab text eol=lf
8+
9+
/tzdata/** text eol=lf
10+
11+
/settings.config text eol=lf
12+
/*.sh text eol=lf

.github/workflows/build.yml

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,37 @@
11
name: Build and run on GitHub Actions
22

33
on:
4-
push:
5-
branches: [ "**" ]
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '41 4 * * *'
67

78
jobs:
89
build:
910

1011
runs-on: ubuntu-latest
1112

1213
steps:
13-
- uses: actions/checkout@v3
14-
1514
- uses: actions/checkout@v3
1615
with:
17-
repository: libical/vzic
18-
ref: 4768ec8008a5af34f164439e605987e2933d471a
19-
path: build/vzic
16+
submodules: true
2017

2118
- name: Install dependencies
2219
run: sudo apt-get update && sudo apt-get install -y libglib2.0-dev
2320

24-
- name: Get settings into GitHub Actions
25-
run: |
26-
. ./settings.config
27-
echo "VZIC_RELEASE_NAME=$VZIC_RELEASE_NAME" >> $GITHUB_ENV
28-
29-
- name: Run build script
30-
run: ./build.sh
31-
32-
- name: Check, whether anything has changed.
33-
run: |
34-
if [[ `git status --porcelain` ]]; then
35-
echo "File changes detected. Will commit and push."
36-
echo "VZIC_PUSH_CHANGES=1" >> $GITHUB_ENV
37-
else
38-
echo "No file changes detected."
39-
echo "VZIC_PUSH_CHANGES=0" >> $GITHUB_ENV
40-
fi
41-
42-
- name: Commit and push changes
43-
if: ${{ env.VZIC_PUSH_CHANGES == 1 }}
21+
- name: Configure git
4422
run: |
4523
git config --global user.name 'GitHub Actions'
4624
git config --global user.email '[email protected]'
47-
git add .
48-
git commit -am "Update tzdata and zoneinfo to version $VZIC_RELEASE_NAME."
49-
git push
5025
51-
- name: Archive artifacts
52-
if: ${{ env.VZIC_PUSH_CHANGES == 1 }}
26+
- name: Run the build script
27+
run: ./build.sh
28+
29+
- name: Archive artifacts if any
5330
uses: actions/upload-artifact@v4
5431
with:
55-
name: tzdbics_${{ env.VZIC_RELEASE_NAME }}
32+
name: tzdbics_artifacts
5633
path: build/out/
57-
if-no-files-found: error
34+
if-no-files-found: ignore
35+
36+
- name: Push changes
37+
run: git push

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vzic"]
2+
path = vzic
3+
url = https://github.com/libical/vzic

Makefile

Lines changed: 0 additions & 106 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# IANA Time Zone Database to iCalendar Translation Database
2-
3-
This repo tracks releases of the [IANA Time Zone Database](https://www.iana.org/time-zones) together with the corresponding translations to the iCalendar format (as defined in RFC 5545).
4-
5-
The translation is performed using [libical's VZIC utility](https://github.com/libical/vzic).
6-
7-
## Updating to a new release of the Time Zone Database
8-
9-
The intended usage is as follows:
10-
* Upon a new release of the IANA Time Zone Database update `settings.config`. Update `VZIC_RELEASE_NAME` to match the name of the new release (e.g. `2022a`).
11-
* Commit and push the change to GitHub.
12-
13-
This will trigger a GitHub Workflow that does the following
14-
* Download the specified version of the IANA Time Zone DB.
15-
* Checkout, build and run vzic
16-
* Merge the newly generated zoneinfo with the previous version, in order to keep TZIDs of unchanged time zones.
17-
* Commit and push the updated tzdata and zoneinfo back to the repo on GitHub.
18-
19-
## Creating a release
20-
21-
To create a new release:
22-
23-
* Bump and push `VZIC_RELEASE_NAME` as outlined above.
24-
* Create a tag named `release_$VZIC_RELEASE_NAME` on the commit created by GitHub Actions.
25-
* Create a GitHub release with the same name on the new tag.
26-
* Add the build artifacts from the automatic build (should be `tzdata$VZIC_RELEASE_NAME.tar.gz` and `zoneinfo-$VZIC_RELEASE_NAME.tar.gz`).
1+
# IANA Time Zone Database to iCalendar Translation Database
2+
3+
This repo tracks releases of the [IANA Time Zone Database](https://www.iana.org/time-zones) together with the corresponding translations to the iCalendar format (as defined in RFC 5545).
4+
5+
The translation is performed using [libical's VZIC utility](https://github.com/libical/vzic).
6+
7+
## Updating to a new release of the Time Zone Database
8+
9+
The intended usage is as follows:
10+
* Upon a new release of the IANA Time Zone Database update `settings.config`. Update `VZIC_RELEASE_NAME` to match the name of the new release (e.g. `2022a`).
11+
* Commit and push the change to GitHub.
12+
13+
This will trigger a GitHub Workflow that does the following
14+
* Download the specified version of the IANA Time Zone DB.
15+
* Checkout, build and run vzic
16+
* Merge the newly generated zoneinfo with the previous version, in order to keep TZIDs of unchanged time zones.
17+
* Commit and push the updated tzdata and zoneinfo back to the repo on GitHub.
18+
19+
## Creating a release
20+
21+
To create a new release:
22+
23+
* Bump and push `VZIC_RELEASE_NAME` as outlined above.
24+
* Create a tag named `release_$VZIC_RELEASE_NAME` on the commit created by GitHub Actions.
25+
* Create a GitHub release with the same name on the new tag.
26+
* Add the build artifacts from the automatic build (should be `tzdata$VZIC_RELEASE_NAME.tar.gz` and `zoneinfo-$VZIC_RELEASE_NAME.tar.gz`).

build.sh

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,80 @@ set -e
1717
# read settings file
1818
. ./settings.config
1919

20-
echo "Building $VZIC_RELEASE_NAME"
20+
echo "Building vzic"
21+
eval "make -C '`pwd`/vzic' -B OLSON_DIR=tzdata $VZIC_MAKE_ARGS"
2122

22-
mkdir -p build/out
23+
if [ ! -d build ]; then mkdir -p build; fi
24+
if [ ! -d build/out ]; then mkdir -p build/out; fi
2325

24-
if [[ ${VZIC_TZDATA_ARCHIVE_URL} ]]; then
25-
echo "Downloading tzdata from $VZIC_TZDATA_ARCHIVE_URL"
26-
wget -q -O build/tzdata$VZIC_RELEASE_NAME.tar.gz $VZIC_TZDATA_ARCHIVE_URL
27-
export VZIC_TZDATA_ARCHIVE_PATH=build/tzdata$VZIC_RELEASE_NAME.tar.gz
26+
if [ -f tzdb_version.txt ]; then
27+
VZIC_CURRENT_RELEASE_NAME=$(cat tzdb_version.txt)
28+
echo "Start version set to $VZIC_CURRENT_RELEASE_NAME from tzdb_version.txt"
29+
else
30+
echo "tzdb_version.txt not found. Exiting."
31+
exit 1
2832
fi
2933

30-
if [[ ${VZIC_TZDATA_ARCHIVE_PATH} ]]; then
31-
echo "Extracting new tzdata"
32-
if [ -d tzdata ]; then rm -rf tzdata; fi
33-
mkdir -p tzdata
34-
tar -xzf $VZIC_TZDATA_ARCHIVE_PATH -C tzdata
34+
tzversions=$(wget -q -O - $VZIC_TZDB_RELEASES_URL | grep -oP 'tzdata\K[\d]+[a-z](?=\.tar\.gz)' | awk '{print ($0 ~ /^9/ ? "19" $0 : $0)}' | sort | uniq)
3535

36-
cp $VZIC_TZDATA_ARCHIVE_PATH build/out
37-
fi
36+
# Filter tzversions to skip versions before VZIC_CURRENT_RELEASE_NAME
37+
tzversions=$(echo "$tzversions" | awk -v start="$VZIC_CURRENT_RELEASE_NAME" '$0 > start')
3838

39-
echo "Building vzic"
40-
eval "make -C '`pwd`/build/vzic' -B OLSON_DIR=tzdata $VZIC_MAKE_ARGS"
39+
export VZIC_RELEASE_NAME=
4140

42-
echo "Running vzic"
43-
if [ -d build/zoneinfo ]; then rm -r build/zoneinfo; fi
44-
mkdir -p build/zoneinfo
45-
eval "./build/vzic/vzic --olson-dir tzdata --output-dir build/zoneinfo $VZIC_INVOCATION_ARGS"
41+
for version in $tzversions; do
4642

47-
export VZIC_ZONEINFO_NEW=`pwd`/build/zoneinfo
43+
export VZIC_RELEASE_NAME=$version
4844

49-
if [[ -d zoneinfo ]]; then
50-
export VZIC_ZONEINFO_MASTER=`pwd`/zoneinfo
45+
echo "Processing version: $version";
5146

52-
echo "Merging..."
53-
./vzic-merge.pl
47+
export VZIC_TZDATA_ARCHIVE_URL=$VZIC_TZDB_RELEASES_URL/tzdata$VZIC_RELEASE_NAME.tar.gz
48+
if [[ ${VZIC_TZDATA_ARCHIVE_URL} ]]; then
49+
echo "Downloading tzdata from $VZIC_TZDATA_ARCHIVE_URL"
50+
wget -q -O build/tzdata$VZIC_RELEASE_NAME.tar.gz $VZIC_TZDATA_ARCHIVE_URL
51+
export VZIC_TZDATA_ARCHIVE_PATH=build/tzdata$VZIC_RELEASE_NAME.tar.gz
52+
fi
5453

55-
# copy updated zones
56-
cp -r $VZIC_ZONEINFO_NEW/zones.* $VZIC_ZONEINFO_MASTER
54+
if [[ ${VZIC_TZDATA_ARCHIVE_PATH} ]]; then
55+
echo "Extracting new tzdata"
56+
if [ -d tzdata ]; then rm -rf tzdata; fi
57+
mkdir -p tzdata
58+
tar -xzf $VZIC_TZDATA_ARCHIVE_PATH -C tzdata
5759

58-
else
59-
cp -r "$VZIC_ZONEINFO_NEW" zoneinfo
60-
export VZIC_ZONEINFO_MASTER=`pwd`/zoneinfo
61-
echo "No master zoneinfo configured. The new zoneinfo will not be merged and kept as is."
62-
fi
60+
cp $VZIC_TZDATA_ARCHIVE_PATH build/out
61+
fi
62+
63+
echo "Running vzic"
64+
if [ -d build/zoneinfo ]; then rm -r build/zoneinfo; fi
65+
mkdir -p build/zoneinfo
66+
eval "./vzic/vzic --olson-dir tzdata --output-dir build/zoneinfo $VZIC_INVOCATION_ARGS"
67+
68+
export VZIC_ZONEINFO_NEW=`pwd`/build/zoneinfo
69+
70+
if [[ -d zoneinfo ]]; then
71+
export VZIC_ZONEINFO_MASTER=`pwd`/zoneinfo
72+
73+
echo "Merging..."
74+
./vzic/vzic-merge.pl
75+
76+
# copy updated zones
77+
cp -r $VZIC_ZONEINFO_NEW/zones.* $VZIC_ZONEINFO_MASTER
78+
79+
else
80+
cp -r "$VZIC_ZONEINFO_NEW" zoneinfo
81+
export VZIC_ZONEINFO_MASTER=`pwd`/zoneinfo
82+
echo "No master zoneinfo configured. The new zoneinfo will not be merged and kept as is."
83+
fi
84+
85+
echo "Creating output archive"
86+
VZIC_OUT_TAR="`pwd`/build/out/zoneinfo-$VZIC_RELEASE_NAME.tar.gz"
87+
pushd $VZIC_ZONEINFO_MASTER
88+
tar -czf "$VZIC_OUT_TAR" *
89+
popd
90+
91+
echo $VZIC_RELEASE_NAME > tzdb_version.txt
92+
93+
git add .
6394

64-
echo "Creating output archive"
65-
VZIC_OUT_TAR="`pwd`/build/out/zoneinfo-$VZIC_RELEASE_NAME.tar.gz"
66-
pushd $VZIC_ZONEINFO_MASTER
67-
tar -czf "$VZIC_OUT_TAR" *
68-
popd
95+
git commit -m "Update zoneinfo to $VZIC_RELEASE_NAME"
96+
done

settings.config

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

2-
VZIC_RELEASE_NAME=2024a
3-
42
# The source tzdata is downloaded from this URL.
5-
VZIC_TZDATA_ARCHIVE_URL="https://data.iana.org/time-zones/releases/tzdata$VZIC_RELEASE_NAME.tar.gz"
3+
VZIC_TAG_PREFIX="release_"
4+
VZIC_TZDB_RELEASES_URL="https://data.iana.org/time-zones/releases/"
65

76
VZIC_PRODID="-//github.com/libical/vzic//NONSGML ICS//EN"
87
VZIC_TZID_PREFIX="/github.com/libical/tzdbics/%D_$VZIC_RELEASE_NAME/"

tzdb_version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024a

vzic

Submodule vzic added at 02a942d

0 commit comments

Comments
 (0)