-
-
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.
feat: Adding scripts for ts-proto, python_betterproto, and grpc-java …
…plugins (#12) Co-authored-by: Patrik <[email protected]>
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ jobs: | |
- uses: ory/build-buf-action@v0 | ||
with: | ||
bufVersion: v0.31.1 | ||
protocPlugins: [email protected] [email protected] | ||
protocPlugins: [email protected] [email protected] [email protected] [email protected] [email protected] | ||
bufArgs: generate --config buf/api/buf.yaml --template buf/api/buf.gen.yaml | ||
# Don't forget to commit and push after this step | ||
``` | ||
|
@@ -38,5 +38,8 @@ Currently, the following plugins are available in the action: | |
|
||
- [go](https://github.com/protocolbuffers/protobuf-go) | ||
- [go-grpc](https://github.com/grpc/grpc-go) | ||
- [python_betterproto](https://github.com/danielgtaylor/python-betterproto) | ||
- [ts-proto](https://github.com/stephenh/ts-proto) | ||
- [grpc-java](https://github.com/grpc/grpc-java) | ||
|
||
Please open a PR to add install scripts for any missing plugin. |
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,22 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
source scripts/executor-info.sh | ||
|
||
PLUGIN_VERSION=$1 | ||
BIN_DIR=$(pwd)/.bin | ||
PLUGIN=protoc-gen-grpc-java | ||
VER_FILE=$BIN_DIR/$PLUGIN.ver | ||
PLUGIN_EXE=$BIN_DIR/$PLUGIN | ||
|
||
# Can't use grep with `set -e pipfail`... | ||
CUR_VER= | ||
if [ -f "$VER_FILE" ]; then CUR_VER=($(<$VER_FILE)); fi | ||
|
||
if [ ! -f "$PLUGIN_EXE" ] || ! [[ " ${CUR_VER[@]} " =~ " ${PLUGIN_VERSION} " ]]; then | ||
echo "Installing $PLUGIN $PLUGIN_VERSION for OS $UNAME_OS Arch $UNAME_ARCH" | ||
mkdir -p $BIN_DIR | ||
curl --fail -sSL "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/$PLUGIN_VERSION/protoc-gen-grpc-java-$PLUGIN_VERSION-$NORMALIZED_OS-$UNAME_ARCH.exe" -o ./.bin/protoc-gen-grpc-java | ||
chmod +x $PLUGIN_EXE | ||
echo "$PLUGIN_VERSION" > $VER_FILE | ||
fi |
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,23 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
source scripts/executor-info.sh | ||
|
||
PLUGIN_VERSION=$1 | ||
BIN_DIR=$(pwd)/.bin | ||
PLUGIN=protoc-gen-python_betterproto | ||
|
||
VER_FILE=$BIN_DIR/$PLUGIN.ver | ||
PLUGIN_EXE=$BIN_DIR/$PLUGIN | ||
|
||
# Can't use grep with `set -e pipfail`... | ||
CUR_VER= | ||
if [ -f "$VER_FILE" ]; then CUR_VER=($(<$VER_FILE)); fi | ||
|
||
if [ ! -f "$PLUGIN_EXE" ] || ! [[ " ${CUR_VER[@]} " =~ " ${PLUGIN_VERSION} " ]]; then | ||
echo "Installing $PLUGIN $PLUGIN_VERSION" | ||
mkdir -p $BIN_DIR | ||
pip install --upgrade --target="$BIN_DIR" "betterproto[compiler]==$PLUGIN_VERSION" | ||
echo "$PLUGIN_VERSION" > $VER_FILE | ||
mv $BIN_DIR/bin/protoc* $BIN_DIR | ||
fi |
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,22 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
source scripts/executor-info.sh | ||
|
||
PLUGIN_VERSION=$1 | ||
BIN_DIR=$(pwd)/.bin | ||
PLUGIN=protoc-gen-ts-proto | ||
VER_FILE=$BIN_DIR/$PLUGIN.ver | ||
PLUGIN_EXE=$BIN_DIR/$PLUGIN | ||
|
||
# Can't use grep with `set -e pipfail`... | ||
CUR_VER= | ||
if [ -f "$VER_FILE" ]; then CUR_VER=($(<$VER_FILE)); fi | ||
|
||
if [ ! -f "$PLUGIN_EXE" ] || ! [[ " ${CUR_VER[@]} " =~ " ${PLUGIN_VERSION} " ]]; then | ||
echo "Installing $PLUGIN $PLUGIN_VERSION" | ||
mkdir -p $BIN_DIR | ||
npm install --prefix $BIN_DIR ts-proto@$PLUGIN_VERSION | ||
echo "$PLUGIN_VERSION" > $VER_FILE | ||
ln -s $BIN_DIR/node_modules/ts-proto/protoc-gen-ts_proto $BIN_DIR/protoc-gen-ts_proto | ||
fi |