Skip to content

Create Hotfix Branch #4

Create Hotfix Branch

Create Hotfix Branch #4

name: Create Hotfix Branch
# Creates a commercial hotfix branch from an OSS tag.
#
# The commercial repo is always the OSS repo with -commercial appended.
# The commercial branch name is derived from the tag by stripping the leading
# 'v' and appending '.x' (e.g. v5.0.1 -> 5.0.1.x).
on:
workflow_dispatch:
inputs:
oss_repo:
description: 'Open source repository (format: org/repo-name)'
required: true
type: string
oss_tag:
description: 'OSS tag to create the hotfix branch from (e.g. v5.0.1)'
required: true
type: string
workflow_call:
inputs:
oss_repo:
description: 'Open source repository (format: org/repo-name)'
required: true
type: string
oss_tag:
description: 'OSS tag to create the hotfix branch from (e.g. v5.0.1)'
required: true
type: string
secrets:
token:
description: 'GitHub token with contents: write on the commercial repo. Falls back to the GH_ACTIONS_REPO_TOKEN organization secret.'
required: false
permissions:
contents: read
jobs:
# Strip the leading 'v' from the tag and append '.x' to form the commercial
# branch name.
derive:
runs-on: ubuntu-latest
outputs:
commercial_repo: ${{ steps.derive.outputs.commercial_repo }}
commercial_branch: ${{ steps.derive.outputs.commercial_branch }}
steps:
- name: Derive commercial repo and branch from tag
id: derive
shell: bash
run: |
OSS_REPO="${{ inputs.oss_repo }}"
OSS_TAG="${{ inputs.oss_tag }}"
COMMERCIAL_REPO="${OSS_REPO}-commercial"
# strip leading 'v' and append '.x' (v5.0.1 -> 5.0.1.x)
COMMERCIAL_BRANCH="${OSS_TAG#v}.x"
echo "commercial_repo=${COMMERCIAL_REPO}" >> "$GITHUB_OUTPUT"
echo "commercial_branch=${COMMERCIAL_BRANCH}" >> "$GITHUB_OUTPUT"
echo "OSS repo: $OSS_REPO"
echo "OSS tag: $OSS_TAG"
echo "Commercial repo: $COMMERCIAL_REPO"
echo "Commercial branch: $COMMERCIAL_BRANCH"
initialize:
needs: derive
uses: ./.github/workflows/initialize-commercial-branch.yml
with:
oss_repo: ${{ inputs.oss_repo }}
oss_tag: ${{ inputs.oss_tag }}
commercial_repo: ${{ needs.derive.outputs.commercial_repo }}
commercial_branch: ${{ needs.derive.outputs.commercial_branch }}
set_default_branch: false
secrets: inherit