From 144aaa87bf815a32734cdb23a94c7263539204bc Mon Sep 17 00:00:00 2001 From: itzaname Date: Sat, 16 Jul 2022 23:10:59 -0400 Subject: [PATCH] Add CI build --- .drone.yml | 35 +++++++++++++++++++++++++++++++++++ scripts/go-gen.sh | 8 ++++++++ 2 files changed, 43 insertions(+) create mode 100644 .drone.yml create mode 100755 scripts/go-gen.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..87591c8 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,35 @@ +--- +kind: pipeline +type: docker +name: generate-go-grpc + +steps: +- name: clone-external + image: alpine/git + commands: + - git clone https://${GIT_USER}:${GIT_PASS}@git.itzana.me/StrafesNET/go-grpc.git + environment: + GIT_USER: + from_secret: GIT_USER + GIT_PASS: + from_secret: GIT_PASS + +- name: generate + image: docker pull registry.itzana.me/strafesnet/tools/protobuild:latest + commands: + - ./scripts/go-gen.sh + +- name: commit + image: alpine/git + commands: + - cd go-grpc + - git add * + - git commit -m "GENERATED: ${DRONE_COMMIT_MESSAGE}" + - git push https://${GIT_USER}:${GIT_PASS}@git.itzana.me/StrafesNET/go-grpc.git --all + +trigger: + ref: + - refs/heads/master + +image_pull_secrets: +- REGISTRY_FILE \ No newline at end of file diff --git a/scripts/go-gen.sh b/scripts/go-gen.sh new file mode 100755 index 0000000..d855d52 --- /dev/null +++ b/scripts/go-gen.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +for f in *.proto +do + name=$(basename $f .proto) + mkdir -p ./go-grpc/$name + protoc --experimental_allow_proto3_optional --go_out=./go-grpc/$name --go_opt=paths=source_relative --go-grpc_out=./go-grpc/$name --go-grpc_opt=paths=source_relative $f +done \ No newline at end of file