-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a prepare_release.sh script that automates some manual steps. (#524)
- Loading branch information
Showing
2 changed files
with
67 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ found [here](../deploy/README.md). | |
Local development uses [Skaffold](https://skaffold.dev) to manage the build, deploy and | ||
port forwarding. | ||
|
||
## Prerequisit | ||
## Prerequisite | ||
|
||
- Contact DataCommons team to get data access to Cloud Bigtable and BigQuery. | ||
|
||
|
@@ -79,11 +79,17 @@ brought up here, can not test the REST API. | |
|
||
### Generate Go proto files | ||
|
||
Run the following code to generate Go proto files. | ||
Install the following packages as a one-time action. | ||
|
||
```bash | ||
cd ~/ # Be sure there is no go.mod in the local directory | ||
go get google.golang.org/protobuf/cmd/[email protected] | ||
go get google.golang.org/grpc/cmd/[email protected] | ||
``` | ||
|
||
Run the following command to generate Go proto files. | ||
|
||
```bash | ||
protoc \ | ||
--proto_path=proto \ | ||
--go_out=internal \ | ||
|
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,59 @@ | ||
#!/bin/bash | ||
# | ||
# A helper script to update the storage versions and prepare a commit for | ||
# release. | ||
# | ||
|
||
DIR=$(dirname "$0") | ||
|
||
cd "$DIR"/.. | ||
VERSION= | ||
|
||
function update_version() { | ||
echo "" | ||
echo "==== Updating BT and BQ versions ====" | ||
|
||
BT=$(curl https://autopush.datacommons.org/version 2>/dev/null | awk '{ if ($1~/^borgcron_/) print $1; }') | ||
printf "$BT" > deploy/storage/bigtable.version | ||
|
||
BQ=$(curl https://autopush.datacommons.org/version 2>/dev/null | awk '{ if ($1~/^datcom-store/) print $1; }') | ||
printf "$BQ" > deploy/storage/bigquery.version | ||
|
||
VERSION="${BT//borgcron_/}" | ||
} | ||
|
||
function update_proto() { | ||
echo "" | ||
echo "==== Updating go proto files ====" | ||
protoc --proto_path=proto --go_out=internal --go-grpc_out=internal \ | ||
--go-grpc_opt=requireUnimplementedServers=false proto/*.proto | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Failed to update proto" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function update_golden() { | ||
echo "" | ||
echo "==== Updating staging golden files ====" | ||
./scripts/update_golden_staging.sh | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Failed to update proto" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function commit() { | ||
echo "" | ||
echo "==== Committing the change ====" | ||
git commit -a -m "Data Release: $VERSION" | ||
} | ||
|
||
update_version | ||
update_proto | ||
update_golden | ||
commit | ||
|
||
echo "" | ||
echo "NOTE: Please review the commit, push to your remote repo and create a PR." | ||
echo "" |