Skip to content

Commit 2f6ed32

Browse files
authored
ci: update release flow to handle unique branch name and do patch releases on merge (#1403)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> resolves #1362 2 changes 1. Accept branch name so that release can be done on multiple branches. 2. separate out release steps since inputs doesn't exist on merge. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new workflow job to extract the clean branch name for release processes. - **Refactor** - Streamlined release workflow by distributing the `release` job's responsibilities into `release-dispatch` and `release-merge` jobs. - Updated job dependencies to incorporate the new `branch_name` job. - **Chores** - Adjusted permissions and conditions for workflow jobs to align with the new workflow structure. - **Documentation** - Updated triage instructions to reflect the changes in the release workflow. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent eccdd0f commit 2f6ed32

1 file changed

Lines changed: 31 additions & 6 deletions

File tree

.github/workflows/ci_release.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,37 @@ jobs:
8585
id: set-outputs
8686
run: echo "has_release_label=${{ fromJSON(steps.get_pr_data.outputs.result).hasReleaseLabel }}" >> "$GITHUB_OUTPUT"
8787

88-
# Make a release if this is a manually trigger job, i.e. workflow_dispatch, or
89-
# there was a merged pr with the create-release label
90-
release:
91-
needs: [lint, test, proto, get_merged_pr_labels]
88+
# branch_name trims ref/heads/ from github.ref to access a clean branch name
89+
branch_name:
90+
runs-on: ubuntu-latest
91+
outputs:
92+
branch: ${{ steps.trim_ref.outputs.branch }}
93+
steps:
94+
- name: Trim branch name
95+
id: trim_ref
96+
run: |
97+
echo "branch=$(${${{ github.ref }}:11})" >> $GITHUB_OUTPUT
98+
99+
# Make a release if this is a manually trigger job, i.e. workflow_dispatch
100+
release-dispatch:
101+
needs: [lint, test, proto, branch_name]
102+
runs-on: ubuntu-latest
103+
if: ${{ github.event_name == 'workflow_dispatch' }}
104+
permissions: "write-all"
105+
steps:
106+
- uses: actions/checkout@v4
107+
- name: Version Release
108+
uses: rollkit/.github/.github/actions/version-release@v0.2.2
109+
with:
110+
github-token: ${{secrets.GITHUB_TOKEN}}
111+
version-bump: ${{inputs.version}}
112+
release-branch: ${{needs.branch_name.outputs.branch}}
113+
114+
# Make a release if there was a merged pr with the create-release label
115+
release-merge:
116+
needs: [lint, test, proto, get_merged_pr_labels, branch_name]
92117
runs-on: ubuntu-latest
93118
if: |
94-
github.event_name == 'workflow_dispatch' ||
95119
(github.event_name == 'push' &&
96120
contains(github.ref, 'refs/heads/main') &&
97121
needs.get_merged_pr_labels.outputs.has_release_label)
@@ -102,4 +126,5 @@ jobs:
102126
uses: rollkit/.github/.github/actions/version-release@v0.2.2
103127
with:
104128
github-token: ${{secrets.GITHUB_TOKEN}}
105-
version-bump: ${{inputs.version}}
129+
version-bump: "patch"
130+
release-branch: ${{needs.branch_name.outputs.branch}}

0 commit comments

Comments
 (0)