-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58109f2
commit 5e8740e
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
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
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) | ||
} |
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
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