Skip to content

Commit

Permalink
Check upstream data release (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn authored Mar 28, 2023
1 parent 58109f2 commit 5e8740e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
56 changes: 56 additions & 0 deletions cmd/checkboundaryrelease/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package main

import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"

"github.com/ringsaturn/requests"
tzfrel "github.com/ringsaturn/tzf-rel"
"github.com/ringsaturn/tzf/pb"
"google.golang.org/protobuf/proto"
)

const API = "https://api.github.com/repos/evansiroky/timezone-boundary-builder/tags"

type TagsResponseItem struct {
Name string `json:"name"`
Commit Commit `json:"commit"`
// ZipballURL string `json:"zipball_url"`
// TarballURL string `json:"tarball_url"`
// NodeID string `json:"node_id"`
}

type Commit struct {
Sha string `json:"sha"`
URL string `json:"url"`
}

func main() {
verbose := flag.Bool("verbose", false, "show more logs")
flag.Parse()
ctx := context.Background()
resp := []*TagsResponseItem{}
err := requests.ReqWithExpectJSONResponse(ctx, http.DefaultClient, "GET", API, nil, &resp)
if err != nil {
panic(err)
}
latestTag := resp[0].Name

input := &pb.PreindexTimezones{}
if err := proto.Unmarshal(tzfrel.PreindexData, input); err != nil {
panic(err)
}
if *verbose {
log.Printf("input.Version=%v, latestTag=%v\n", input.Version, latestTag)
}
if input.Version == latestTag {
log.Println("Same version, bye!")
os.Exit(1)
return
}
fmt.Printf("TIMEZONE_BOUNDARY_VERSION=%s\n", latestTag)
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/paulmach/orb v0.9.0
github.com/ringsaturn/go-cities.json v0.3.5
github.com/ringsaturn/polyf v0.0.0-20221203140730-bfa046f8af27
github.com/ringsaturn/requests v0.1.0
github.com/ringsaturn/tzf-rel v0.0.2023-b
github.com/tidwall/geojson v1.4.3
github.com/tidwall/lotsa v1.0.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ github.com/ringsaturn/go-cities.json v0.3.5 h1:MCRHTdXyXwh6EVbHp17otHrktDulK0Vu/
github.com/ringsaturn/go-cities.json v0.3.5/go.mod h1:qpTYJsvNi40oTJs0WEdRdNAbWcLBWSL7oRHUxMrF4g8=
github.com/ringsaturn/polyf v0.0.0-20221203140730-bfa046f8af27 h1:zKR4J+B+Aayd3ib6Y0BGuLqjJQCRlF2yVoA1RiDrUrU=
github.com/ringsaturn/polyf v0.0.0-20221203140730-bfa046f8af27/go.mod h1:+oMllvWOIIjXhH69ceZhEAXfA7kmfo75wIJoC3MRsa4=
github.com/ringsaturn/tzf-rel v0.0.2022-g1.0.20230326130439-db41fe04bde9 h1:JtA4RtC2VSboRyO3w/aEwX1jU/T9Y/AB95t73GGXoK8=
github.com/ringsaturn/tzf-rel v0.0.2022-g1.0.20230326130439-db41fe04bde9/go.mod h1:TvyUIUpF3aCH98QYjTmMb1cqK7pFswdFLoIVZwGNV/M=
github.com/ringsaturn/requests v0.1.0 h1:3W152Lc80Man+V7AoeZamKhUiZEKuHZVfPWdzdVNJkM=
github.com/ringsaturn/requests v0.1.0/go.mod h1:dq7MKwNyXr9AKHdNvUlpguFE9TJSdjdsAqN3NTQfsuI=
github.com/ringsaturn/tzf-rel v0.0.2023-b h1:27Kt3ewlXJ/nkYFedYWmKbj7CUWzG0UxFYXQAjzPgBE=
github.com/ringsaturn/tzf-rel v0.0.2023-b/go.mod h1:TvyUIUpF3aCH98QYjTmMb1cqK7pFswdFLoIVZwGNV/M=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down

0 comments on commit 5e8740e

Please sign in to comment.