From 9ef63d41eb6b36cdec0ed319abb841297ca40717 Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 10:07:48 -0500 Subject: [PATCH 01/10] test action.yml --- make-protos/action.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 make-protos/action.yml diff --git a/make-protos/action.yml b/make-protos/action.yml new file mode 100644 index 0000000..5d1aa9b --- /dev/null +++ b/make-protos/action.yml @@ -0,0 +1,23 @@ +name: 'Make Protos' +description: 'Make protobuf files' +inputs: + who-to-greet: # id of input + description: 'Who to greet' + required: true + default: 'World' +outputs: + random-number: + description: "Random number" + value: ${{ steps.random-number-generator.outputs.random-number }} +runs: + using: "composite" + steps: + - run: echo Hello ${{ inputs.who-to-greet }}. + shell: bash + - id: random-number-generator + run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT + shell: bash + - run: echo "${{ github.action_path }}" >> $GITHUB_PATH + shell: bash + - run: goodbye.sh + shell: bash From eb506a43d7feeb789cb7dd66a0c07de2a93b24bf Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 11:06:39 -0500 Subject: [PATCH 02/10] added make-protos.sh --- make-protos/action.yml | 12 +++++------- make-protos/make-protos.sh | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100755 make-protos/make-protos.sh diff --git a/make-protos/action.yml b/make-protos/action.yml index 5d1aa9b..8abc9cb 100644 --- a/make-protos/action.yml +++ b/make-protos/action.yml @@ -1,10 +1,10 @@ name: 'Make Protos' -description: 'Make protobuf files' +description: 'Generate protobuf files' inputs: - who-to-greet: # id of input - description: 'Who to greet' + mrpc-dir: # directory of mrpc files + description: 'Directory of mrpc files' required: true - default: 'World' + default: 'mrpc' outputs: random-number: description: "Random number" @@ -12,12 +12,10 @@ outputs: runs: using: "composite" steps: - - run: echo Hello ${{ inputs.who-to-greet }}. - shell: bash - id: random-number-generator run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT shell: bash - run: echo "${{ github.action_path }}" >> $GITHUB_PATH shell: bash - - run: goodbye.sh + - run: make-protos.sh "${{ inputs.mrpc-dir }}" shell: bash diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh new file mode 100755 index 0000000..55b5875 --- /dev/null +++ b/make-protos/make-protos.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Make Protos + +#Check if MRPC tools have been downloaded +MRPC_DIR=$1 + +if [ -z $MRPC_DIR ]; then + MRPC_DIR="mrpc" +fi + +if [ -d $MRPC_DIR ]; then + cd mrpc + tar zxvf mrpc-darwin-amd64.tar.gz + echo $PATH + make protos +else + echo "$MRPC_DIR does not exist" +fi From 6878df8af368dc7a9eb2a3b2732dd1cecdd292fd Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 13:24:56 -0500 Subject: [PATCH 03/10] Fixed path in make-protos --- make-protos/action.yml | 11 ++--------- make-protos/make-protos.sh | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/make-protos/action.yml b/make-protos/action.yml index 8abc9cb..bca54fa 100644 --- a/make-protos/action.yml +++ b/make-protos/action.yml @@ -1,21 +1,14 @@ name: 'Make Protos' description: 'Generate protobuf files' inputs: - mrpc-dir: # directory of mrpc files + directory: # directory of mrpc files description: 'Directory of mrpc files' required: true default: 'mrpc' -outputs: - random-number: - description: "Random number" - value: ${{ steps.random-number-generator.outputs.random-number }} runs: using: "composite" steps: - - id: random-number-generator - run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT - shell: bash - - run: echo "${{ github.action_path }}" >> $GITHUB_PATH + - run: echo "${{ github.action_path }}/${{ inputs.mrpc-dir }}/bin" >> $GITHUB_PATH shell: bash - run: make-protos.sh "${{ inputs.mrpc-dir }}" shell: bash diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh index 55b5875..3395474 100755 --- a/make-protos/make-protos.sh +++ b/make-protos/make-protos.sh @@ -12,6 +12,7 @@ if [ -d $MRPC_DIR ]; then cd mrpc tar zxvf mrpc-darwin-amd64.tar.gz echo $PATH + cd $HOME make protos else echo "$MRPC_DIR does not exist" From 93e58ed2ed0cbc2f940b72833da2e41f0480c029 Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 13:56:04 -0500 Subject: [PATCH 04/10] Update action.yml --- make-protos/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-protos/action.yml b/make-protos/action.yml index bca54fa..069f81d 100644 --- a/make-protos/action.yml +++ b/make-protos/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - run: echo "${{ github.action_path }}/${{ inputs.mrpc-dir }}/bin" >> $GITHUB_PATH + - run: echo "${{ github.action_path }}/${{ inputs.directory }}/bin" >> $GITHUB_PATH shell: bash - - run: make-protos.sh "${{ inputs.mrpc-dir }}" + - run: $GITHUB_ACTION_PATH/make-protos.sh "${{ inputs.directory }}" shell: bash From a15f48c333db55b9a0de9253886bb347037d76ce Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 14:33:19 -0500 Subject: [PATCH 05/10] Update make-protos.sh --- make-protos/make-protos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh index 3395474..2fc06d7 100755 --- a/make-protos/make-protos.sh +++ b/make-protos/make-protos.sh @@ -9,10 +9,10 @@ if [ -z $MRPC_DIR ]; then fi if [ -d $MRPC_DIR ]; then - cd mrpc + cd $MRPC_DIR tar zxvf mrpc-darwin-amd64.tar.gz echo $PATH - cd $HOME + cd $GITHUB_ACTION_PATH make protos else echo "$MRPC_DIR does not exist" From ee4e8287f15363edb7ccf6a18b2ad3f5b296a26a Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 14:45:24 -0500 Subject: [PATCH 06/10] Update make-protos.sh --- make-protos/make-protos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh index 2fc06d7..4e1506f 100755 --- a/make-protos/make-protos.sh +++ b/make-protos/make-protos.sh @@ -12,7 +12,7 @@ if [ -d $MRPC_DIR ]; then cd $MRPC_DIR tar zxvf mrpc-darwin-amd64.tar.gz echo $PATH - cd $GITHUB_ACTION_PATH + cd $GITHUB_WORKSPACE make protos else echo "$MRPC_DIR does not exist" From a6f123756bcc6b6df80805e82b1996609bc7a9ef Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 15:05:23 -0500 Subject: [PATCH 07/10] Update make-protos.sh --- make-protos/make-protos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh index 4e1506f..54d0791 100755 --- a/make-protos/make-protos.sh +++ b/make-protos/make-protos.sh @@ -13,6 +13,7 @@ if [ -d $MRPC_DIR ]; then tar zxvf mrpc-darwin-amd64.tar.gz echo $PATH cd $GITHUB_WORKSPACE + find . -name "protoc-gen-mesa-swift" -ls make protos else echo "$MRPC_DIR does not exist" From 1c905ad9b82cc00a73d9249e4fe5ee1c015e4fc5 Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 15:17:36 -0500 Subject: [PATCH 08/10] Update action.yml --- make-protos/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-protos/action.yml b/make-protos/action.yml index 069f81d..d3d440a 100644 --- a/make-protos/action.yml +++ b/make-protos/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - run: echo "${{ github.action_path }}/${{ inputs.directory }}/bin" >> $GITHUB_PATH + - run: echo "${{ github.workspace }}/${{ inputs.directory }}/bin" >> $GITHUB_PATH shell: bash - run: $GITHUB_ACTION_PATH/make-protos.sh "${{ inputs.directory }}" shell: bash From 12bc57631a3eb33caf7b4ec6934ff14c2231992b Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Wed, 25 Jan 2023 15:24:27 -0500 Subject: [PATCH 09/10] Update make-protos.sh --- make-protos/make-protos.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make-protos/make-protos.sh b/make-protos/make-protos.sh index 54d0791..76e56ae 100755 --- a/make-protos/make-protos.sh +++ b/make-protos/make-protos.sh @@ -13,8 +13,9 @@ if [ -d $MRPC_DIR ]; then tar zxvf mrpc-darwin-amd64.tar.gz echo $PATH cd $GITHUB_WORKSPACE - find . -name "protoc-gen-mesa-swift" -ls make protos + git commit -am "make protos" + git push else echo "$MRPC_DIR does not exist" fi From 9304ddc53b2b05ba2f31e703f7ad92dfc54bebd3 Mon Sep 17 00:00:00 2001 From: Lismond Bernard Date: Fri, 27 Jan 2023 16:58:17 -0500 Subject: [PATCH 10/10] Added documentation and test --- .github/workflows/test.yaml | 8 ++++++++ make-protos/README.md | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 make-protos/README.md diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dcf2f9a..3ba067f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -73,3 +73,11 @@ jobs: version: v1.3.2 - name: Assert Terraform on PATH run: terraform --version + + make-protos: + name: Testing Make Protos + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + diff --git a/make-protos/README.md b/make-protos/README.md new file mode 100644 index 0000000..9515210 --- /dev/null +++ b/make-protos/README.md @@ -0,0 +1,16 @@ +# Make Protobuf + +This action is used to update protobufs for swift code + +The directory parameter should be set to the place where the mprc files are downloaded +It is optional and defaults to "mrpc" + +```yaml +- uses: lismondbernard/actions/make-protos@v1 + with: + directory: "mrpc" +``` + +## Developing + +This code is composite actions based mostly on bash scripts.