From 78f0855664f893d1727e570d7ad4580b9ab71a25 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Wed, 8 Oct 2025 18:04:32 +0200 Subject: [PATCH 01/16] TA-4043: Add release management workflows --- .github/action/bump-npm-version/action.yml | 17 ++- .../workflows/build-and-publish-automatic.yml | 58 --------- .github/workflows/build-master.yml | 122 ++++++++++++++++++ ...ild-and-publish.yml => create-release.yml} | 34 ++--- .github/workflows/publish-on-bump.yml | 104 +++++++++++++++ 5 files changed, 248 insertions(+), 87 deletions(-) delete mode 100644 .github/workflows/build-and-publish-automatic.yml create mode 100644 .github/workflows/build-master.yml rename .github/workflows/{build-and-publish.yml => create-release.yml} (63%) create mode 100644 .github/workflows/publish-on-bump.yml diff --git a/.github/action/bump-npm-version/action.yml b/.github/action/bump-npm-version/action.yml index a638888d..8c788a24 100644 --- a/.github/action/bump-npm-version/action.yml +++ b/.github/action/bump-npm-version/action.yml @@ -1,6 +1,5 @@ name: Bump NPM Version - inputs: bump: description: 'Which version bump (patch, minor, major)' @@ -11,12 +10,17 @@ inputs: repository: description: 'GitHub repository to push changes to' required: true + branch: + description: 'Branch name to create and push (e.g., release/2025.10.06)' + required: true runs: using: composite steps: - name: Checkout Code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 @@ -30,10 +34,15 @@ runs: git config user.email 'github-celobot@celonis.com' git remote set-url origin https://x-access-token:${{ inputs.token }}@github.com/${{ inputs.repository }} - - name: Run npm version + - name: Create branch + shell: bash + run: | + git checkout -b ${{ inputs.branch }} + + - name: Run npm version bump shell: bash run: | - npm version ${{ inputs.bump }} -m "chore: bump version to %s" + npm version ${{ inputs.bump }} -m "[Release] Bump version to %s" npm install git push origin HEAD - git push origin --tags + git push origin --tags \ No newline at end of file diff --git a/.github/workflows/build-and-publish-automatic.yml b/.github/workflows/build-and-publish-automatic.yml deleted file mode 100644 index 181cf3a9..00000000 --- a/.github/workflows/build-and-publish-automatic.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build and Publish Workflow - -on: - push: - branches: [ master ] - paths-ignore: - - '.github/**' - -jobs: - build: - runs-on: ubuntu-latest - name: Npm install and npm build - - steps: - - uses: actions/checkout@v2 - - - name: Setup Node with Github Registry - uses: actions/setup-node@v1 - with: - node-version: '20' - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' - - - name: Yarn Install - run: yarn install - - - name: Yarn Build - run: yarn build - - - name: Yarn Test - run: yarn test - - - name: Move files to build - run: | - cp README.md dist/README.md - cp LICENSE dist/LICENSE - - - name: Publish to Github Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: cd dist/ && npm publish - - - name: Setup publish to Npm Registry - uses: actions/setup-node@v1 - with: - node-version: '16' - registry-url: https://registry.npmjs.org/ - scope: '@celonis' - - - name: Publish to Npm Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: cd dist/ && npm publish --access public - - - uses: actions/checkout@master - name: Checkout Master - with: - fetch-depth: '0' diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml new file mode 100644 index 00000000..ade4292c --- /dev/null +++ b/.github/workflows/build-master.yml @@ -0,0 +1,122 @@ +name: Build and Publish Workflow + +on: + push: + branches: + - master + paths-ignore: + - '.github/**' + +jobs: + detect-bump: + name: Detect Version Bump + runs-on: ubuntu-latest + outputs: + is_bump: ${{ steps.check.outputs.is_bump }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - id: check + name: Check if commit is version bump + run: | + last_commit_message=$(git log -1 --pretty=%B) + echo "Last commit message: $last_commit_message" + + if [[ "$last_commit_message" =~ "[Release]: Bump version" ]]; then + echo "is_bump=true" >> $GITHUB_OUTPUT + else + echo "is_bump=false" >> $GITHUB_OUTPUT + fi + + build: + name: Build + runs-on: ubuntu-latest + needs: detect-bump + if: needs.detect-bump.outputs.is_bump != 'true' + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://npm.pkg.github.com/celonis + scope: '@celonis' + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Test + run: yarn test + + - name: Done + run: echo "Build finished" + + build-and-publish: + name: Build and Publish + runs-on: ubuntu-latest + needs: detect-bump + if: needs.detect-bump.outputs.is_bump == 'true' + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node (GitHub Registry) + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://npm.pkg.github.com/celonis + scope: '@celonis' + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Test + run: yarn test + + - name: Prepare dist folder + run: | + cp README.md dist/README.md + cp LICENSE dist/LICENSE + + - name: Publish to GitHub Registry + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Publishing to GitHub Registry..." + cd dist/ + npm publish + + - name: Setup Node for NPM Registry + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://registry.npmjs.org/ + scope: '@celonis' + + - name: Publish to NPM Registry + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "Publishing to npm Registry..." + cd dist/ + npm publish --access public + + - name: Done + run: echo "Version bump detected — published successfully." diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/create-release.yml similarity index 63% rename from .github/workflows/build-and-publish.yml rename to .github/workflows/create-release.yml index 49c89084..39404ac8 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/create-release.yml @@ -1,4 +1,4 @@ -name: Build and Publish Workflow +name: Create Release on: workflow_dispatch: @@ -19,19 +19,25 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Compute CalVer + id: calver + run: echo "calver=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT - - name: Bump NPM version + - name: Bump NPM version on CalVer branch uses: ./.github/action/bump-npm-version with: bump: ${{ inputs.bump }} token: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} repository: ${{ github.repository }} + branch: release/${{ steps.calver.outputs.calver }} build: needs: version-bump runs-on: ubuntu-latest name: Npm install and npm build - steps: - uses: actions/checkout@v2 @@ -51,28 +57,6 @@ jobs: - name: Yarn Test run: yarn test - - name: Move files to build - run: | - cp README.md dist/README.md - cp LICENSE dist/LICENSE - - - name: Publish to Github Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: cd dist/ && npm publish - - - name: Setup publish to Npm Registry - uses: actions/setup-node@v1 - with: - node-version: '16' - registry-url: https://registry.npmjs.org/ - scope: '@celonis' - - - name: Publish to Npm Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: cd dist/ && npm publish --access public - - uses: actions/checkout@master name: Checkout Master with: diff --git a/.github/workflows/publish-on-bump.yml b/.github/workflows/publish-on-bump.yml new file mode 100644 index 00000000..2e00b1e0 --- /dev/null +++ b/.github/workflows/publish-on-bump.yml @@ -0,0 +1,104 @@ +name: Build and Publish Workflow + +on: + push: + branches: + - master + paths-ignore: + - '.github/**' + +jobs: + build: + name: Build & Test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node with GitHub Registry + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://npm.pkg.github.com/celonis + scope: '@celonis' + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Build Project + run: yarn build + + - name: Run Tests + run: yarn test + + - name: Move files to dist + run: | + cp README.md dist/README.md + cp LICENSE dist/LICENSE + + - name: Check if last commit is a version bump + id: check_version_bump + run: | + last_commit_message=$(git log -1 --pretty=%B) + echo "Last commit message: $last_commit_message" + + if [[ "$last_commit_message" =~ "[Release]: Bump version" ]]; then + echo "is_bump=true" >> $GITHUB_OUTPUT + else + echo "is_bump=false" >> $GITHUB_OUTPUT + fi + + - name: Upload Build Artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + retention-days: 1 + + outputs: + is_bump: ${{ steps.check_version_bump.outputs.is_bump }} + + publish: + name: Publish to Registries + runs-on: ubuntu-latest + needs: build + if: needs.build.outputs.is_bump == 'true' + + steps: + - name: Download Build Artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + + - name: Setup Node for GitHub Registry + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://npm.pkg.github.com/celonis + scope: '@celonis' + + - name: Publish to GitHub Registry + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd dist/ + npm publish + + - name: Setup Node for NPM Registry + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: https://registry.npmjs.org/ + scope: '@celonis' + + - name: Publish to NPM Registry + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + cd dist/ + npm publish --access public From d1f289f60ae9f241107182e479244c3b22566f02 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Wed, 8 Oct 2025 18:05:01 +0200 Subject: [PATCH 02/16] TA-4043: Change some echo messages --- .github/workflows/build-master.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index ade4292c..4b6cb8dc 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -99,7 +99,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "Publishing to GitHub Registry..." + echo "Publishing to GitHub Registry" cd dist/ npm publish @@ -114,9 +114,9 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: | - echo "Publishing to npm Registry..." + echo "Publishing to npm Registry" cd dist/ npm publish --access public - name: Done - run: echo "Version bump detected — published successfully." + run: echo "Version bump detected, published successfully." From 37b7ac55bd1c09e8d6bd1b0e3d210631a9ecca1a Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Wed, 8 Oct 2025 18:07:19 +0200 Subject: [PATCH 03/16] TA-4043: Fix CalVer format in release branch names --- .github/workflows/create-release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 39404ac8..92e80641 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -22,11 +22,14 @@ jobs: with: fetch-depth: 0 - - name: Compute CalVer + - name: Determine CalVer Branch Name id: calver - run: echo "calver=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT + run: | + branch_name=$(date +"%Y%m%d-%H%M%S_RC00") + echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + echo "Creating release branch: $branch_name" - - name: Bump NPM version on CalVer branch + - name: Bump NPM version on release branch uses: ./.github/action/bump-npm-version with: bump: ${{ inputs.bump }} From d7e477f2172ea4f6bc607775845b17dd3c77081e Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Wed, 8 Oct 2025 18:17:46 +0200 Subject: [PATCH 04/16] TA-4043: Provide hotfix actions --- ...{build-master.yml => build-or-publish.yml} | 5 +- .github/workflows/create-release.yml | 33 ++++-- .github/workflows/publish-on-bump.yml | 104 ------------------ 3 files changed, 26 insertions(+), 116 deletions(-) rename .github/workflows/{build-master.yml => build-or-publish.yml} (97%) delete mode 100644 .github/workflows/publish-on-bump.yml diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-or-publish.yml similarity index 97% rename from .github/workflows/build-master.yml rename to .github/workflows/build-or-publish.yml index 4b6cb8dc..d46e9aec 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-or-publish.yml @@ -1,9 +1,10 @@ -name: Build and Publish Workflow +name: Build / Publish Workflow on: push: branches: - - master + - 'master' + - 'release/*' paths-ignore: - '.github/**' diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 92e80641..abc2770c 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -22,12 +22,22 @@ jobs: with: fetch-depth: 0 - - name: Determine CalVer Branch Name + - name: Determine Unique CalVer Branch Name id: calver + shell: bash run: | - branch_name=$(date +"%Y%m%d-%H%M%S_RC00") + base_name=$(date +"%Y%m%d-%H%M%S") + rc_index=0 + + git fetch origin "+refs/heads/release/*:refs/remotes/origin/release/*" || true + + while git branch -r | grep -q "origin/release/${base_name}_RC$(printf '%02d' $rc_index)"; do + rc_index=$((rc_index + 1)) + done + + branch_name="${base_name}_RC$(printf '%02d' $rc_index)" echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - echo "Creating release branch: $branch_name" + echo "Release branch name: release/${branch_name}" - name: Bump NPM version on release branch uses: ./.github/action/bump-npm-version @@ -35,19 +45,21 @@ jobs: bump: ${{ inputs.bump }} token: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} repository: ${{ github.repository }} - branch: release/${{ steps.calver.outputs.calver }} + branch: release/${{ steps.calver.outputs.branch_name }} build: needs: version-bump runs-on: ubuntu-latest name: Npm install and npm build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node with Github Registry - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: '20' + node-version: 20 registry-url: https://npm.pkg.github.com/celonis scope: '@celonis' @@ -60,7 +72,8 @@ jobs: - name: Yarn Test run: yarn test - - uses: actions/checkout@master - name: Checkout Master + - name: Checkout Master + uses: actions/checkout@v4 with: - fetch-depth: '0' + ref: master + fetch-depth: 0 diff --git a/.github/workflows/publish-on-bump.yml b/.github/workflows/publish-on-bump.yml deleted file mode 100644 index 2e00b1e0..00000000 --- a/.github/workflows/publish-on-bump.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Build and Publish Workflow - -on: - push: - branches: - - master - paths-ignore: - - '.github/**' - -jobs: - build: - name: Build & Test - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node with GitHub Registry - uses: actions/setup-node@v4 - with: - node-version: '20' - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' - - - name: Install Dependencies - run: yarn install --frozen-lockfile - - - name: Build Project - run: yarn build - - - name: Run Tests - run: yarn test - - - name: Move files to dist - run: | - cp README.md dist/README.md - cp LICENSE dist/LICENSE - - - name: Check if last commit is a version bump - id: check_version_bump - run: | - last_commit_message=$(git log -1 --pretty=%B) - echo "Last commit message: $last_commit_message" - - if [[ "$last_commit_message" =~ "[Release]: Bump version" ]]; then - echo "is_bump=true" >> $GITHUB_OUTPUT - else - echo "is_bump=false" >> $GITHUB_OUTPUT - fi - - - name: Upload Build Artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: dist - path: dist/ - retention-days: 1 - - outputs: - is_bump: ${{ steps.check_version_bump.outputs.is_bump }} - - publish: - name: Publish to Registries - runs-on: ubuntu-latest - needs: build - if: needs.build.outputs.is_bump == 'true' - - steps: - - name: Download Build Artifact - uses: actions/download-artifact@v4 - with: - name: dist - path: dist - - - name: Setup Node for GitHub Registry - uses: actions/setup-node@v4 - with: - node-version: '20' - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' - - - name: Publish to GitHub Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd dist/ - npm publish - - - name: Setup Node for NPM Registry - uses: actions/setup-node@v4 - with: - node-version: '20' - registry-url: https://registry.npmjs.org/ - scope: '@celonis' - - - name: Publish to NPM Registry - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - cd dist/ - npm publish --access public From 8735465c311f2287dcd88cd4bd97130b0a882327 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Wed, 8 Oct 2025 18:18:39 +0200 Subject: [PATCH 05/16] TA-4043: Rename Build PR workflow for clarity --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b554afe..53cb3b80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Workflow +name: Build Pull Request on: pull_request: From dfdd8b16e801b91cc796634f0e98e54fabc3acb7 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 14:21:46 +0200 Subject: [PATCH 06/16] TA-4043: Change release logic --- .github/workflows/build-or-publish.yml | 89 ++++++++++++++++++-------- .github/workflows/create-release.yml | 73 ++++++++------------- 2 files changed, 86 insertions(+), 76 deletions(-) diff --git a/.github/workflows/build-or-publish.yml b/.github/workflows/build-or-publish.yml index d46e9aec..1a5327a5 100644 --- a/.github/workflows/build-or-publish.yml +++ b/.github/workflows/build-or-publish.yml @@ -8,36 +8,47 @@ on: paths-ignore: - '.github/**' +permissions: + contents: write + jobs: detect-bump: name: Detect Version Bump runs-on: ubuntu-latest outputs: is_bump: ${{ steps.check.outputs.is_bump }} + commit_sha: ${{ steps.sha.outputs.sha }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 2 + - id: sha + name: Get pushed commit SHA + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + - id: check - name: Check if commit is version bump + name: Check if last commit is a version bump + shell: bash run: | last_commit_message=$(git log -1 --pretty=%B) echo "Last commit message: $last_commit_message" - - if [[ "$last_commit_message" =~ "[Release]: Bump version" ]]; then + if [[ "$last_commit_message" =~ "\[Release\] Bump version" ]]; then echo "is_bump=true" >> $GITHUB_OUTPUT else echo "is_bump=false" >> $GITHUB_OUTPUT fi - build: - name: Build + - name: Echo outputs + run: | + echo "is_bump = ${{ steps.check.outputs.is_bump }}" + + build-only: + name: Build (no publish) runs-on: ubuntu-latest needs: detect-bump if: needs.detect-bump.outputs.is_bump != 'true' - steps: - name: Checkout uses: actions/checkout@v4 @@ -61,38 +72,62 @@ jobs: run: yarn test - name: Done - run: echo "Build finished" + run: echo "Regular commit detected — build and test completed." - build-and-publish: - name: Build and Publish + create-release-branch-and-publish: + name: Create release branch (CalVer) and Publish runs-on: ubuntu-latest needs: detect-bump - if: needs.detect-bump.outputs.is_bump == 'true' - + if: needs.detect-bump.outputs.is_bump == 'true' && github.ref == 'refs/heads/master' + permissions: + contents: write steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup Node (GitHub Registry) - uses: actions/setup-node@v4 - with: - node-version: '20' - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' + - name: Setup Git user + run: | + git config user.name "celobot" + git config user.email "github-celobot@celonis.com" - - name: Install Dependencies - run: yarn install --frozen-lockfile + - name: Compute unique CalVer release branch name + id: calver + shell: bash + env: + GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + run: | + base_name=$(date +"%Y%m%d-%H%M%S") - - name: Build - run: yarn build + git fetch origin "+refs/heads/release/*:refs/remotes/origin/release/*" || true - - name: Test - run: yarn test + rc_index=0 + candidate="${base_name}_RC$(printf '%02d' $rc_index)" + while git branch -r | grep -q "origin/release/${candidate}"; do + rc_index=$((rc_index + 1)) + candidate="${base_name}_RC$(printf '%02d' $rc_index)" + done + + release_branch="release/${candidate}" + echo "release_branch=${release_branch}" >> $GITHUB_OUTPUT + echo "Selected release branch: ${release_branch}" + + - name: Create and push release branch from current master commit + env: + GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + shell: bash + run: | + release_branch="${{ steps.calver.outputs.release_branch }}" + echo "Creating release branch ${release_branch} from current HEAD (master)" + git checkout -b "${release_branch}" + git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "refs/heads/${release_branch}:refs/heads/${release_branch}" - - name: Prepare dist folder + - name: Prepare dist run: | + yarn install --frozen-lockfile + yarn build + yarn test cp README.md dist/README.md cp LICENSE dist/LICENSE @@ -100,7 +135,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "Publishing to GitHub Registry" cd dist/ npm publish @@ -115,9 +149,8 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: | - echo "Publishing to npm Registry" cd dist/ npm publish --access public - - name: Done - run: echo "Version bump detected, published successfully." + - name: Post-publish note + run: echo "Release branch ${{ steps.calver.outputs.release_branch }} created and published." diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index abc2770c..b4f4530e 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -13,8 +13,13 @@ on: - minor - major +permissions: + contents: write + pull-requests: write + jobs: - version-bump: + create-bump-pr: + name: Create bump PR runs-on: ubuntu-latest steps: - name: Checkout @@ -22,58 +27,30 @@ jobs: with: fetch-depth: 0 - - name: Determine Unique CalVer Branch Name - id: calver - shell: bash + - name: Compute automation branch name + id: names run: | - base_name=$(date +"%Y%m%d-%H%M%S") - rc_index=0 - - git fetch origin "+refs/heads/release/*:refs/remotes/origin/release/*" || true - - while git branch -r | grep -q "origin/release/${base_name}_RC$(printf '%02d' $rc_index)"; do - rc_index=$((rc_index + 1)) - done - - branch_name="${base_name}_RC$(printf '%02d' $rc_index)" - echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - echo "Release branch name: release/${branch_name}" + ts=$(date +"%Y%m%d-%H%M%S") + auto_branch="automation/release-bump-${ts}" + echo "auto_branch=${auto_branch}" >> $GITHUB_OUTPUT + echo "automation branch: ${auto_branch}" - - name: Bump NPM version on release branch + - name: Create temporary branch and bump version uses: ./.github/action/bump-npm-version with: bump: ${{ inputs.bump }} token: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} repository: ${{ github.repository }} - branch: release/${{ steps.calver.outputs.branch_name }} + branch: ${{ steps.names.outputs.auto_branch }} - build: - needs: version-bump - runs-on: ubuntu-latest - name: Npm install and npm build - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node with Github Registry - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' - - - name: Yarn Install - run: yarn install - - - name: Yarn Build - run: yarn build - - - name: Yarn Test - run: yarn test - - - name: Checkout Master - uses: actions/checkout@v4 - with: - ref: master - fetch-depth: 0 + - name: Open PR from temporary branch -> master + env: + GH_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + run: | + auto_branch="${{ steps.names.outputs.auto_branch }}" + gh pr create \ + --repo "${{ github.repository }}" \ + --base master \ + --head "${auto_branch}" \ + --title "[Release] Bump version - automated" \ + --body "Automated version bump (created by Create Release workflow). Please review and merge." From cc54307f9d3af3ec8ca5d63712b81146c9bc111b Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 14:31:56 +0200 Subject: [PATCH 07/16] TA-4043: Add master/release restriction to create-release workflow --- .github/workflows/create-release.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index b4f4530e..086dae4f 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -27,6 +27,18 @@ jobs: with: fetch-depth: 0 + - name: Validate base branch (only master or release/* allowed) + id: validate + shell: bash + run: | + BASE="${{ github.ref_name }}" + echo "Validating base branch: $BASE" + if [[ ! "$BASE" =~ ^master$ ]] && [[ ! "$BASE" =~ ^release\/.+$ ]]; then + echo "ERROR: workflow may only be dispatched from 'master' or a 'release/*' branch. Selected: $BASE" + exit 1 + fi + echo "ok=true" >> $GITHUB_OUTPUT + - name: Compute automation branch name id: names run: | From 947eb3a43556dc4f92690c1e967d220d74382650 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 14:37:55 +0200 Subject: [PATCH 08/16] TA-4043: Make base wherever the workflow was triggered from --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 086dae4f..a3c4655a 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -62,7 +62,7 @@ jobs: auto_branch="${{ steps.names.outputs.auto_branch }}" gh pr create \ --repo "${{ github.repository }}" \ - --base master \ + --base "${{ github.ref_name }}" \ --head "${auto_branch}" \ --title "[Release] Bump version - automated" \ --body "Automated version bump (created by Create Release workflow). Please review and merge." From f35aacae226e8494dcef7ad4603531ad979befc8 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 14:38:56 +0200 Subject: [PATCH 09/16] TA-4043: Simplify automated branch creation --- .github/action/bump-npm-version/action.yml | 17 ++++++++++++----- .github/workflows/create-release.yml | 18 +++++------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/action/bump-npm-version/action.yml b/.github/action/bump-npm-version/action.yml index 8c788a24..deb42ed3 100644 --- a/.github/action/bump-npm-version/action.yml +++ b/.github/action/bump-npm-version/action.yml @@ -10,9 +10,11 @@ inputs: repository: description: 'GitHub repository to push changes to' required: true - branch: - description: 'Branch name to create and push (e.g., release/2025.10.06)' - required: true + +outputs: + auto_branch: + description: 'The created automation branch name' + value: ${{ steps.names.outputs.auto_branch }} runs: using: composite @@ -34,10 +36,15 @@ runs: git config user.email 'github-celobot@celonis.com' git remote set-url origin https://x-access-token:${{ inputs.token }}@github.com/${{ inputs.repository }} - - name: Create branch + - name: Compute automation branch name + id: names shell: bash run: | - git checkout -b ${{ inputs.branch }} + ts=$(date +"%Y%m%d-%H%M%S") + auto_branch="automation/release-bump-${ts}" + echo "auto_branch=${auto_branch}" >> $GITHUB_OUTPUT + echo "Creating automation branch: ${auto_branch}" + git checkout -b "${auto_branch}" - name: Run npm version bump shell: bash diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index a3c4655a..26f57132 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -21,6 +21,7 @@ jobs: create-bump-pr: name: Create bump PR runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 @@ -39,30 +40,21 @@ jobs: fi echo "ok=true" >> $GITHUB_OUTPUT - - name: Compute automation branch name - id: names - run: | - ts=$(date +"%Y%m%d-%H%M%S") - auto_branch="automation/release-bump-${ts}" - echo "auto_branch=${auto_branch}" >> $GITHUB_OUTPUT - echo "automation branch: ${auto_branch}" - - - name: Create temporary branch and bump version + - name: Run bump version and create automation branch + id: bump uses: ./.github/action/bump-npm-version with: bump: ${{ inputs.bump }} token: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} repository: ${{ github.repository }} - branch: ${{ steps.names.outputs.auto_branch }} - - name: Open PR from temporary branch -> master + - name: Open PR from automation branch env: GH_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} run: | - auto_branch="${{ steps.names.outputs.auto_branch }}" gh pr create \ --repo "${{ github.repository }}" \ + --head "${{ steps.bump.outputs.auto_branch }}" \ --base "${{ github.ref_name }}" \ - --head "${auto_branch}" \ --title "[Release] Bump version - automated" \ --body "Automated version bump (created by Create Release workflow). Please review and merge." From 27ceaf45aede1ca877756eabac7e499256b7ed36 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 15:02:03 +0200 Subject: [PATCH 10/16] TA-4043: Add release branch tagging --- .github/workflows/build-or-publish.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-or-publish.yml b/.github/workflows/build-or-publish.yml index 1a5327a5..c7f555b5 100644 --- a/.github/workflows/build-or-publish.yml +++ b/.github/workflows/build-or-publish.yml @@ -152,5 +152,15 @@ jobs: cd dist/ npm publish --access public + - name: Tag release version + env: + GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + shell: bash + run: | + version=$(node -p "require('./package.json').version") + tag="v${version}" + git tag "${tag}" + git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "${tag}" + - name: Post-publish note - run: echo "Release branch ${{ steps.calver.outputs.release_branch }} created and published." + run: echo "Release branch ${{ steps.calver.outputs.release_branch }} created, published, and tagged with version." From c347594adf40a6cc04b90a7350a7f5fb60c636ca Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Thu, 9 Oct 2025 15:29:29 +0200 Subject: [PATCH 11/16] TA-4043: Add release management guide --- docs/how-to-release.md | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 docs/how-to-release.md diff --git a/docs/how-to-release.md b/docs/how-to-release.md new file mode 100644 index 00000000..d7be0c93 --- /dev/null +++ b/docs/how-to-release.md @@ -0,0 +1,74 @@ +# Content CLI – Release Management Guide + +This guide describes how the **Content CLI** release lifecycle works — including feature development, release creation, and hotfixing. + +--- + +## Overview + +The Content CLI uses a **trunk-based workflow** with **semantic version bumps** and **CalVer release branches**. + +| **Branch Type** | **Purpose** | +|------------------|------------------------------------------------------------------------------------| +| `master` | Main development branch; represents the development environment. | +| `release/*` | Release branches named using CalVer format (e.g., `release/20251009-091337_RC00`). | + +Publishing happens **only** when a version bump PR is merged. + +--- + +## Developing a New Feature + +1. Create a feature branch from `master`. +2. Implement and test your feature. +3. Open a PR targeting `master`. +4. After approval, merge your PR into `master`. + - Merging to `master` **does not** publish anything — it only updates the development state of the CLI. + +--- + +## Creating a Release + +When the `master` branch is stable and ready for deployment, use the **Create Release** workflow. + +### Steps + +1. Go to **Actions → Create Release → Run workflow**. +2. Choose the bump type (`patch`, `minor`, or `major`). +3. The workflow will: + - Validate that it’s running from `master` or a `release/*` branch. + - Create an automation branch (`automation/release-bump-`). + - Bump the version and push a commit like `[Release] Bump version to x.x.x`. + - Open a **PR to the same branch** from which it was triggered (to master or release branch). + +4. When the PR is approved and merged: + - The **Build / Publish** workflow detects the version bump commit. + - It builds and tests the CLI. + - Creates a new **CalVer release branch** (e.g., `release/20251009-091337_RC00`). + - Publishes the package to both: + - GitHub Registry (`@celonis/content-cli`) + - npm Registry (`@celonis/content-cli`) + - Tags the release branch with the new semantic version (e.g., `v1.3.0`). + +--- + +## Hotfixing a Version + +When a bug is discovered in an existing published version: + +1. Identify the release branch from the version tag (e.g., `release/20251009-091337_RC00` tagged with `v1.3.0`). +2. Create a hotfix branch from that release branch. +3. Implement and test the fix. +4. Open a PR targeting the same release branch. +5. Once merged, re-run the **Create Release** workflow from that release branch to bump the patch version and publish (e.g., from `v1.3.0` → `v1.3.1`). + +--- + +## Workflows + +| **Workflow** | **Trigger** | **Purpose** | +|---------------|-------------|--------------| +| **Build Pull Request** | On PR to `master` | Builds and tests changes before merging. | +| **Create Release** | Manual trigger (`workflow_dispatch`) | Creates a PR with a version bump on the current branch. | +| **Build / Publish** | On merge to `master` or `release/*` | Detects version bumps → builds, tags, and publishes. | + From 71cf55fba039a96140d18e84b96f54daab6b174a Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Tue, 14 Oct 2025 18:02:58 +0200 Subject: [PATCH 12/16] TA-4043: Link local build guide in the "developing a new feature" section --- docs/how-to-release.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/how-to-release.md b/docs/how-to-release.md index d7be0c93..052c69f8 100644 --- a/docs/how-to-release.md +++ b/docs/how-to-release.md @@ -21,6 +21,7 @@ Publishing happens **only** when a version bump PR is merged. 1. Create a feature branch from `master`. 2. Implement and test your feature. + - Testing should be done locally. Check this guide for [testing your local build of master](https://github.com/celonis/content-cli/blob/master/README.md#building-and-using-the-project-locally). 3. Open a PR targeting `master`. 4. After approval, merge your PR into `master`. - Merging to `master` **does not** publish anything — it only updates the development state of the CLI. From e882d791bd3fe169df227e168163dc62178479f9 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Tue, 14 Oct 2025 18:06:16 +0200 Subject: [PATCH 13/16] TA-4043: Remove GIT_CLI_ADMIN_TOKEN usage --- .github/workflows/build-or-publish.yml | 6 +++--- .github/workflows/create-release.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-or-publish.yml b/.github/workflows/build-or-publish.yml index c7f555b5..e7f2c678 100644 --- a/.github/workflows/build-or-publish.yml +++ b/.github/workflows/build-or-publish.yml @@ -96,7 +96,7 @@ jobs: id: calver shell: bash env: - GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | base_name=$(date +"%Y%m%d-%H%M%S") @@ -115,7 +115,7 @@ jobs: - name: Create and push release branch from current master commit env: - GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | release_branch="${{ steps.calver.outputs.release_branch }}" @@ -154,7 +154,7 @@ jobs: - name: Tag release version env: - GIT_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | version=$(node -p "require('./package.json').version") diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 26f57132..6af0957a 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -45,12 +45,12 @@ jobs: uses: ./.github/action/bump-npm-version with: bump: ${{ inputs.bump }} - token: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} - name: Open PR from automation branch env: - GH_TOKEN: ${{ secrets.GIT_CLI_ADMIN_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh pr create \ --repo "${{ github.repository }}" \ From 0a4791f3176ffd281f4a3a922a4911f0c72324dd Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Tue, 14 Oct 2025 18:16:52 +0200 Subject: [PATCH 14/16] TA-4043: Add restriction for release branch on bump type to only patch --- .github/workflows/create-release.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 6af0957a..f2777913 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -28,16 +28,28 @@ jobs: with: fetch-depth: 0 - - name: Validate base branch (only master or release/* allowed) + - name: Validate base branch and bump type id: validate shell: bash run: | BASE="${{ github.ref_name }}" + BUMP="${{ inputs.bump }}" echo "Validating base branch: $BASE" + echo "Requested bump type: $BUMP" + + # Restrict workflow execution to master or release/* if [[ ! "$BASE" =~ ^master$ ]] && [[ ! "$BASE" =~ ^release\/.+$ ]]; then echo "ERROR: workflow may only be dispatched from 'master' or a 'release/*' branch. Selected: $BASE" exit 1 fi + + # Restrict bump types on release branches + if [[ "$BASE" =~ ^release\/.+$ ]] && [[ "$BUMP" != "patch" ]]; then + echo "ERROR: Only 'patch' bumps are allowed on release branches (attempted '$BUMP')." + exit 1 + fi + + echo "Validation passed for $BASE with bump '$BUMP'" echo "ok=true" >> $GITHUB_OUTPUT - name: Run bump version and create automation branch From 8d2aa0d06845c9857f02e4d412622a85e4d652bf Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Tue, 14 Oct 2025 18:26:56 +0200 Subject: [PATCH 15/16] TA-4043: Extract `build` part of the workflow in its own action --- .github/action/build/action.yml | 30 ++++++++++++++++++ .github/workflows/build-or-publish.yml | 43 +++++--------------------- 2 files changed, 38 insertions(+), 35 deletions(-) create mode 100644 .github/action/build/action.yml diff --git a/.github/action/build/action.yml b/.github/action/build/action.yml new file mode 100644 index 00000000..7b0afdff --- /dev/null +++ b/.github/action/build/action.yml @@ -0,0 +1,30 @@ +name: Build +description: Reusable action to install dependencies, build the project, and run tests. + +inputs: + node-version: + description: Node.js version to use + required: false + default: '20' + +runs: + using: composite + steps: + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + registry-url: 'https://npm.pkg.github.com/celonis' + scope: '@celonis' + + - name: Install Dependencies + shell: bash + run: yarn install --frozen-lockfile + + - name: Build + shell: bash + run: yarn build + + - name: Test + shell: bash + run: yarn test \ No newline at end of file diff --git a/.github/workflows/build-or-publish.yml b/.github/workflows/build-or-publish.yml index e7f2c678..f6cf52b0 100644 --- a/.github/workflows/build-or-publish.yml +++ b/.github/workflows/build-or-publish.yml @@ -25,12 +25,9 @@ jobs: fetch-depth: 2 - id: sha - name: Get pushed commit SHA run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - id: check - name: Check if last commit is a version bump - shell: bash run: | last_commit_message=$(git log -1 --pretty=%B) echo "Last commit message: $last_commit_message" @@ -40,10 +37,6 @@ jobs: echo "is_bump=false" >> $GITHUB_OUTPUT fi - - name: Echo outputs - run: | - echo "is_bump = ${{ steps.check.outputs.is_bump }}" - build-only: name: Build (no publish) runs-on: ubuntu-latest @@ -55,21 +48,8 @@ jobs: with: fetch-depth: 0 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: '20' - registry-url: https://npm.pkg.github.com/celonis - scope: '@celonis' - - - name: Install Dependencies - run: yarn install --frozen-lockfile - - - name: Build - run: yarn build - - - name: Test - run: yarn test + - name: Build and Test + uses: ./.github/action/build-and-test - name: Done run: echo "Regular commit detected — build and test completed." @@ -94,9 +74,6 @@ jobs: - name: Compute unique CalVer release branch name id: calver - shell: bash - env: - GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | base_name=$(date +"%Y%m%d-%H%M%S") @@ -108,7 +85,6 @@ jobs: rc_index=$((rc_index + 1)) candidate="${base_name}_RC$(printf '%02d' $rc_index)" done - release_branch="release/${candidate}" echo "release_branch=${release_branch}" >> $GITHUB_OUTPUT echo "Selected release branch: ${release_branch}" @@ -116,18 +92,16 @@ jobs: - name: Create and push release branch from current master commit env: GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash run: | - release_branch="${{ steps.calver.outputs.release_branch }}" - echo "Creating release branch ${release_branch} from current HEAD (master)" - git checkout -b "${release_branch}" - git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "refs/heads/${release_branch}:refs/heads/${release_branch}" + branch="${{ steps.calver.outputs.release_branch }}" + git checkout -b "$branch" + git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "HEAD:refs/heads/${branch}" + + - name: Build and Test + uses: ./.github/action/build-and-test - name: Prepare dist run: | - yarn install --frozen-lockfile - yarn build - yarn test cp README.md dist/README.md cp LICENSE dist/LICENSE @@ -155,7 +129,6 @@ jobs: - name: Tag release version env: GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash run: | version=$(node -p "require('./package.json').version") tag="v${version}" From e0014c5a68ab537435ae1034fd1d456a9ee64440 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Tue, 14 Oct 2025 18:28:25 +0200 Subject: [PATCH 16/16] TA-4043: Fix used action name --- .github/workflows/build-or-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-or-publish.yml b/.github/workflows/build-or-publish.yml index f6cf52b0..e2e157b9 100644 --- a/.github/workflows/build-or-publish.yml +++ b/.github/workflows/build-or-publish.yml @@ -49,7 +49,7 @@ jobs: fetch-depth: 0 - name: Build and Test - uses: ./.github/action/build-and-test + uses: ./.github/action/build - name: Done run: echo "Regular commit detected — build and test completed." @@ -98,7 +98,7 @@ jobs: git push https://x-access-token:${GIT_TOKEN}@github.com/${{ github.repository }} "HEAD:refs/heads/${branch}" - name: Build and Test - uses: ./.github/action/build-and-test + uses: ./.github/action/build - name: Prepare dist run: |