From 28cc49b74f71736d3c2564d6dbbb0299db4d1e5a Mon Sep 17 00:00:00 2001 From: David Byron <82477955+dbyron-sf@users.noreply.github.com> Date: Fri, 1 Apr 2022 15:15:58 -0700 Subject: [PATCH] feat(build): bump dependencies for the given branch (#4247) --- .github/workflows/bump_dependencies.yml | 1 + .github/workflows/release.yml | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bump_dependencies.yml b/.github/workflows/bump_dependencies.yml index cdfaa3bc6c..c60800d069 100644 --- a/.github/workflows/bump_dependencies.yml +++ b/.github/workflows/bump_dependencies.yml @@ -11,6 +11,7 @@ jobs: - uses: spinnaker/bumpdeps@master with: ref: ${{ github.event.client_payload.ref }} + baseBranch: ${{ github.event.client_payload.branch }} key: orcaVersion repositories: kayenta mavenRepositoryUrl: https://repo.maven.apache.org/maven2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7889b44035..c6f3668793 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,26 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + # Given a tag, determine what branch we are on, so we can bump dependencies in the correct branch + - name: Get Branch + run: | + BRANCHES=$(git branch -r --contains ${{ github.ref }}) + echo "BRANCHES is '${BRANCHES}'" + # Check for no branches explicitly...Otherwise echo adds a newline so wc thinks there's + # one branch. And echo -n makes it appears that there's one less branch than there + # actually is. + if [ -z "$BRANCHES" ]; then + echo "exactly one branch required to release orca, but there are none" + exit 1 + fi + NUM_BRANCHES=$(($(echo "$BRANCHES" | wc -l))) + echo "NUM_BRANCHES is '${NUM_BRANCHES}'" + if [ $NUM_BRANCHES -ne 1 ]; then + echo "exactly one branch required to release orca, but there are $NUM_BRANCHES ($BRANCHES)" + exit 1 + fi + echo "exactly one branch ($BRANCHES)" + echo BRANCH=$BRANCHES >> $GITHUB_ENV - uses: actions/setup-java@v2 with: java-version: 11 @@ -105,4 +125,4 @@ jobs: with: token: ${{ secrets.SPINNAKER_GITHUB_TOKEN }} event-type: bump-dependencies - client-payload: '{"ref": "${{ github.ref }}"}' + client-payload: '{"ref": "${{ github.ref }}", "branch": "${{ env.BRANCH}}"}'