From 33f749f1c9d38dcc50e9167d92da04389d7ec61c Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 17 Mar 2022 19:11:37 +0000 Subject: [PATCH] Set up `main -> v2`, `v2 -> v1`, and `v2 -> main` merges --- .github/workflows/post-release-mergeback.yml | 3 ++- .github/workflows/update-release-branch.yml | 23 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/post-release-mergeback.yml b/.github/workflows/post-release-mergeback.yml index 636bd18d1..b6bc16d05 100644 --- a/.github/workflows/post-release-mergeback.yml +++ b/.github/workflows/post-release-mergeback.yml @@ -15,6 +15,7 @@ on: push: branches: - v1 + - v2 jobs: merge-back: @@ -90,7 +91,7 @@ jobs: git push origin --follow-tags "$VERSION" - name: Create mergeback branch - if: steps.check.outputs.exists != 'true' + if: steps.check.outputs.exists != 'true' && contains(github.ref, 'v2') env: VERSION: "${{ steps.getVersion.outputs.version }}" NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}" diff --git a/.github/workflows/update-release-branch.yml b/.github/workflows/update-release-branch.yml index d77c2b41b..5271eda2e 100644 --- a/.github/workflows/update-release-branch.yml +++ b/.github/workflows/update-release-branch.yml @@ -1,5 +1,13 @@ name: Update release branch -on: workflow_dispatch +on: + # You can trigger this workflow via workflow dispatch to start a release. + # This will open a PR to update the v2 release branch. + workflow_dispatch: + + # When the v2 release is complete, this workflow will open a PR to update the v1 release branch. + push: + branches: + - v2 jobs: update: @@ -27,11 +35,22 @@ jobs: git config --global user.email "github-actions@github.com" git config --global user.name "github-actions[bot]" - - name: Update release branch + - name: Update v2 release branch + if: github.event_name == 'workflow_dispatch' run: | python .github/update-release-branch.py \ --github-token ${{ secrets.GITHUB_TOKEN }} \ --repository-nwo ${{ github.repository }} \ --source-branch main \ + --target-branch v2 \ + --conductor ${GITHUB_ACTOR} + + - name: Update v1 release branch + if: github.event_name == 'push' + run: | + python .github/update-release-branch.py \ + --github-token ${{ secrets.GITHUB_TOKEN }} \ + --repository-nwo ${{ github.repository }} \ + --source-branch v2 \ --target-branch v1 \ --conductor ${GITHUB_ACTOR}