From e22b99d3342b0ca6fae0f9631f4d69737dac0773 Mon Sep 17 00:00:00 2001 From: Mitsu Date: Sun, 21 Dec 2025 13:31:26 +0900 Subject: [PATCH 1/3] refactor: extract tzVersion from tzdata URL --- scripts/tzgen/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/tzgen/main.go b/scripts/tzgen/main.go index 51b2ba5..dcb5062 100644 --- a/scripts/tzgen/main.go +++ b/scripts/tzgen/main.go @@ -16,7 +16,10 @@ import ( "strings" ) -const tzdataURL = "https://data.iana.org/time-zones/releases/tzdata2025b.tar.gz" +const ( + tzVersion = "2025b" + tzdataURL = "https://data.iana.org/time-zones/releases/tzdata" + tzVersion + ".tar.gz" +) func main() { if err := run(context.Background()); err != nil { From 8de0073fad5a451733136e9b860313914b600a63 Mon Sep 17 00:00:00 2001 From: Mitsu Date: Sun, 21 Dec 2025 13:33:46 +0900 Subject: [PATCH 2/3] ci: add tzdata update workflow --- .github/workflows/tzdata-update.yml | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/tzdata-update.yml diff --git a/.github/workflows/tzdata-update.yml b/.github/workflows/tzdata-update.yml new file mode 100644 index 0000000..996319a --- /dev/null +++ b/.github/workflows/tzdata-update.yml @@ -0,0 +1,51 @@ +name: tzdata update +on: + schedule: + - cron: "0 23 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Fetch latest tzcode version + run: | + set -euo pipefail + workdir=$(mktemp -d) + wget -O "$workdir/tzcode-latest.tar.gz" https://www.iana.org/time-zones/repository/tzcode-latest.tar.gz + tar -xzf "$workdir/tzcode-latest.tar.gz" -C "$workdir" + + version_file=$(find "$workdir" -maxdepth 2 -type f -name version | head -n 1) + if [ -z "$version_file" ]; then + echo "version file not found in tzcode-latest.tar.gz" >&2 + exit 1 + fi + + latest_version=$(tr -d ' \n' < "$version_file") + current_version=$(grep -E 'tzVersion' scripts/tzgen/main.go | sed -E 's/.*"([^"]+)".*/\1/' | head -n 1) + + echo "current=$current_version latest=$latest_version" + if [ "$latest_version" = "$current_version" ]; then + echo "tzdata is already up to date" + exit 0 + fi + + sed -i.bak -E 's/tzVersion = ".*"/tzVersion = "'"$latest_version"'"/' scripts/tzgen/main.go + rm -f scripts/tzgen/main.go.bak + gofmt -w scripts/tzgen/main.go + go run scripts/tzgen/main.go + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add scripts/tzgen/main.go tz + git commit -m "Update tzdata to ${latest_version}" + git push From 160d879b4c751fafd2e1cc06271354275901d1a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 22 Dec 2025 23:24:07 +0000 Subject: [PATCH 3/3] Update tzdata to 2025c --- scripts/tzgen/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tzgen/main.go b/scripts/tzgen/main.go index dcb5062..a3737e8 100644 --- a/scripts/tzgen/main.go +++ b/scripts/tzgen/main.go @@ -17,7 +17,7 @@ import ( ) const ( - tzVersion = "2025b" + tzVersion = "2025c" tzdataURL = "https://data.iana.org/time-zones/releases/tzdata" + tzVersion + ".tar.gz" )