From b3d9117e4bac03528bfafb742e96715d7de4f01d Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:28:23 -0400 Subject: [PATCH] Update workflow for workflow_call event (#120) --- .github/workflows/build-unified.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-unified.yml b/.github/workflows/build-unified.yml index 0f27b3b..6869c6e 100644 --- a/.github/workflows/build-unified.yml +++ b/.github/workflows/build-unified.yml @@ -6,6 +6,13 @@ on: paths: - "docker-unified/**" - ".github/workflows/build-self-host.yml" + workflow_call: + inputs: + server_branch: + description: "Server branch name to deploy (examples: 'master', 'rc', 'feature/sm')" + required: true + type: string + default: master workflow_dispatch: inputs: server_branch: @@ -29,17 +36,8 @@ jobs: - name: Get server branch to checkout id: server-branch-name env: - GITHUB_EVENT_NAME: ${{ github.event_name }} SERVER_BRANCH: ${{ github.event.inputs.server_branch }} - run: | - SERVER_BRANCH=${SERVER_BRANCH:11} - if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then - echo "server_branch=$SERVER_BRANCH" >> $GITHUB_OUTPUT - echo "Branch: $SERVER_BRANCH" - else - echo "server_branch=master" >> $GITHUB_OUTPUT - echo "Branch: master" - fi + run: echo "server_branch=${SERVER_BRANCH#refs/heads/}" >> $GITHUB_OUTPUT - name: Check Branch to Publish env: @@ -49,7 +47,7 @@ jobs: run: | IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES - if [[ " ${publish_branches[*]} " =~ " ${GITHUB_REF:11} " && " ${publish_branches[*]} " =~ " ${SERVER_BRANCH} " ]]; then + if [[ " ${publish_branches[*]} " =~ " ${SERVER_BRANCH} " ]]; then echo "is_publish_branch=true" >> $GITHUB_ENV else echo "is_publish_branch=false" >> $GITHUB_ENV