Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
release-on-push:
if: github.event.pull_request.merged || inputs.version_bump != ''
runs-on: 'ubuntu-latest'
env:
TARGET_BRANCH: ${{ github.base_ref || github.ref_name }}
steps:
- name: Checkout Code
uses: actions/checkout@v6
Expand All @@ -67,7 +69,7 @@ jobs:

- name: Retrieve last tag on branch
run: |
git checkout ${{ github.base_ref }}
git checkout "$TARGET_BRANCH"
echo "TAG_NAME=$(git describe --tags --match "v*.*.*" --abbrev=0 | cut -c 2-)" >> $GITHUB_OUTPUT
id: last_tag

Expand Down Expand Up @@ -101,16 +103,16 @@ jobs:

- name: Debug branch name
run: |
echo current branch ${{ github.base_ref }}
echo current branch $TARGET_BRANCH
- name: Exit on bad tag
if: ${{ (inputs.version_bump == 'major' || (inputs.version_bump == '' && contains(github.event.pull_request.labels.*.name, 'release:major'))) && !contains(github.base_ref, inputs.main_branch) }}
if: ${{ (inputs.version_bump == 'major' || (inputs.version_bump == '' && contains(github.event.pull_request.labels.*.name, 'release:major'))) && !contains(env.TARGET_BRANCH, inputs.main_branch) }}
run: |
echo Can't create a major release on branch ${{ github.base_ref }}
echo Can't create a major release on branch $TARGET_BRANCH
exit 1
- name: Exit on bad branch
if: ${{ !contains(fromJson(inputs.dist_branches), github.base_ref) }}
if: ${{ !contains(fromJson(inputs.dist_branches), env.TARGET_BRANCH) }}
run: |
echo Can't create a release on branch ${{ github.base_ref }}
echo Can't create a release on branch $TARGET_BRANCH
exit 1

- name: Prepare release tag env var
Expand Down Expand Up @@ -189,15 +191,15 @@ jobs:
if: ${{ !contains(env.RELEASE_VERSION, 'undefined') && (inputs.version_ini_path != '' || inputs.toml_conf_path != '' || inputs.package_json_version == 'true') }}
with:
commit_message: "chore: update version"
branch: ${{ github.base_ref }}
branch: ${{ env.TARGET_BRANCH }}

- name: Create release and tag
if: ${{ !contains(env.RELEASE_VERSION, 'undefined') }}
uses: ncipollo/release-action@v1
with:
name: 'Release ${{ env.RELEASE_VERSION }}'
tag: 'v${{ env.RELEASE_VERSION }}'
commit: ${{ github.base_ref }}
commit: ${{ env.TARGET_BRANCH }}
generateReleaseNotes: true

outputs:
Expand Down
Loading