From d4aea2788175dabe5ec022c0e6267900f4c24194 Mon Sep 17 00:00:00 2001 From: Teppei Fukuda Date: Wed, 5 Jun 2024 14:33:12 +0400 Subject: [PATCH] ci: create release branch (#6859) Signed-off-by: knqyf263 --- .github/workflows/release-please.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 290cdce1c4ce..de3e0def9ddd 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -55,7 +55,7 @@ jobs: if: ${{ steps.extract_info.outputs.version }} uses: actions/github-script@v7 with: - github-token: ${{ secrets.ORG_REPO_TOKEN }} + github-token: ${{ secrets.ORG_REPO_TOKEN }} # To trigger another workflow script: | await github.rest.git.createRef({ owner: context.repo.owner, @@ -64,6 +64,23 @@ jobs: sha: context.sha }); + # When v0.50.0 is released, a release branch "release/v0.50" is created. + - name: Create release branch for patch versions + if: ${{ endsWith(steps.extract_info.outputs.version, '.0') }} + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} # Should not trigger the workflow again + script: | + const version = '${{ steps.extract_info.outputs.version }}'; + const minorVersion = version.slice(0, version.lastIndexOf('.')); + const releaseBranch = `release/v${minorVersion}`; + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/heads/${releaseBranch}`, + sha: context.sha + }); + # Since skip-github-release is specified, googleapis/release-please-action doesn't delete the label from PR. # This label prevents the subsequent PRs from being created. Therefore, we need to delete it ourselves. # cf. https://github.com/googleapis/release-please?tab=readme-ov-file#release-please-bot-does-not-create-a-release-pr-why @@ -71,7 +88,7 @@ jobs: if: ${{ steps.extract_info.outputs.pr_number }} uses: actions/github-script@v7 with: - github-token: ${{ secrets.ORG_REPO_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const prNumber = parseInt('${{ steps.extract_info.outputs.pr_number }}', 10); github.rest.issues.removeLabel({