Skip to content

Commit 3e209be

Browse files
authored
Merge pull request #58 from didoda/fix/2.x/release-use-github-base-ref
Fix use `github.base_ref` in release
2 parents b327111 + 2405a78 commit 3e209be

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,19 @@ jobs:
9898
echo new major ${{ steps.versions.outputs.NEW_MAJOR }}
9999
echo new minor ${{ steps.versions.outputs.NEW_MINOR }}
100100
echo new patch ${{ steps.versions.outputs.NEW_PATCH }}
101-
- name: Extract branch name
102-
shell: bash
103-
run: echo "BRANCH=$(echo ${github.base_ref})" >> $GITHUB_OUTPUT
104-
id: branch
105101
106102
- name: Debug branch name
107103
run: |
108-
echo current branch ${{ steps.branch.outputs.BRANCH }}
104+
echo current branch ${{ github.base_ref }}
109105
- name: Exit on bad tag
110-
if: ${{ (inputs.version_bump == 'major' || (inputs.version_bump == '' && contains(github.event.pull_request.labels.*.name, 'release:major'))) && !contains(steps.branch.outputs.BRANCH, inputs.main_branch) }}
106+
if: ${{ (inputs.version_bump == 'major' || (inputs.version_bump == '' && contains(github.event.pull_request.labels.*.name, 'release:major'))) && !contains(github.base_ref, inputs.main_branch) }}
111107
run: |
112-
echo Can't create a major release on branch ${{ steps.branch.outputs.BRANCH }}
108+
echo Can't create a major release on branch ${{ github.base_ref }}
113109
exit 1
114110
- name: Exit on bad branch
115-
if: ${{ !contains(fromJson(inputs.dist_branches), steps.branch.outputs.BRANCH) }}
111+
if: ${{ !contains(fromJson(inputs.dist_branches), github.base_ref) }}
116112
run: |
117-
echo Can't create a release on branch ${{ steps.branch.outputs.BRANCH }}
113+
echo Can't create a release on branch ${{ github.base_ref }}
118114
exit 1
119115
120116
- name: Prepare release tag env var
@@ -193,15 +189,15 @@ jobs:
193189
if: ${{ !contains(env.RELEASE_VERSION, 'undefined') && (inputs.version_ini_path != '' || inputs.toml_conf_path != '' || inputs.package_json_version == 'true') }}
194190
with:
195191
commit_message: "chore: update version"
196-
branch: ${{ steps.branch.outputs.BRANCH }}
192+
branch: ${{ github.base_ref }}
197193

198194
- name: Create release and tag
199195
if: ${{ !contains(env.RELEASE_VERSION, 'undefined') }}
200196
uses: ncipollo/release-action@v1
201197
with:
202198
name: 'Release ${{ env.RELEASE_VERSION }}'
203199
tag: 'v${{ env.RELEASE_VERSION }}'
204-
commit: ${{ steps.branch.outputs.BRANCH }}
200+
commit: ${{ github.base_ref }}
205201
generateReleaseNotes: true
206202

207203
outputs:

0 commit comments

Comments
 (0)