From 3895413bb6b7eac9e723c436bdf7de9a253d4426 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 11:58:39 +0530 Subject: [PATCH 01/17] ci(releases): committing for github to identify the workflow --- .github/workflows/releases.yml | 170 +++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..58d81ad --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,170 @@ +name: Generate GH Release with Proper Release Notes for OpenTofu Modules + +on: + push: + workflow_dispatch: + inputs: + module_name: + description: Name of the module to perform a release for + type: environment + required: true + release_type: + description: Type of release that to be performed + type: choice + options: + - patch + - minor + - major + default: patch + is_dev_release: + description: Perform a development release than a full release? + type: boolean + default: false + +jobs: + prepare_release_details: + runs-on: ubuntu-latest + environment: ${{ inputs.module_name }} + env: + MODULE: ${{ inputs.module_name }} + RELEASE_TYPE: ${{ inputs.release_type }} + IS_DEV_RELEASE: ${{ inputs.is_dev_release }} + CURRENT_FULL_VERSION: ${{ vars.FULL_VERSION || '0.0.0' }} + steps: + - name: Checking out the repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 + + # - name: Checking if there's anything committed to create a new release + # run: | + + # # Count commits in the module path excluding [INF] + # CHANGE_COUNT=$(git log $CURRENT_FULL_VERSION..HEAD --oneline -- "modules/$MODULE" | grep -v "\[INF\]" | wc -l) + + # if [ "$CHANGE_COUNT" -eq "0" ]; then + # echo "::error title=No Changes Detected::No non-[INF] commits found in modules/$MODULE since $CURRENT_FULL_VERSION." + # exit 1 + # fi + # echo "Found $CHANGE_COUNT relevant changes." + + # - id: version + # name: Calculating the next release version from the previous if it exists + # run: | + + # # Fetch the raw version without any development tags if it exists + # BASE_VERSION=$(echo "$CURRENT_FULL_VERSION" | cut -d "." -f1) + + # # If the previous release was a development version, extract the release number + # DEV_VERSION=$(echo "$CURRENT_FULL_VERSION" | grep -oP 'dev\.\K\d+' || echo "0") + + # # Calculating the next release version + # # Case 1: if the current release was a dev version and the next one is not, the next + # # release version will be the base version without any dev tags added onto it + # if [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "false" ]]; then + # NEXT_RELEASE_VERSION="$BASE_VERSION" + + # # Case 2: if the current release was a dev version and the next one is also a dev + # # release, the next release version will be the same with the dev version incremented + # elif [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "true" ]]; then + # DEV_VERSION=$(( DEV_VERSION + 1 )) + # NEXT_RELEASE_VERSION="$BASE_VERSION-dev.$DEV_VERSION" + + # # Case 3: if the current release is not a dev version and the next too is not + # # According to the provided inputs, increment major/minor/patch version and + # # make that as the next release version to be performed + # else + # # Split the basen version up using period + # # and extract the individual versions + # IFS='.' read -ra VERSIONS <<< "$BASE_VERSION" + # MAJOR_VERSION=${VERSIONS[0]} + # MINOR_VERSION=${VERSIONS[1]} + # PATCH_VERSION=${VERSIONS[2]} + + # # Increment the version according to the inputs and create the final version + # if [[ "$RELEASE_TYPE" == "major" ]]; then MAJOR_VERSION=$(( MAJOR_VERSION + 1 )); MINOR_VERSION=0; PATCH_VERSION=0; + # elif [[ "$RELEASE_TYPE" == "minor" ]]; then MINOR_VERSION=$(( MINOR_VERSION + 1 )); PATCH_VERSION=0; + # else PATCH_VERSION=$(( PATCH_VERSION + 1 )); fi + + # NEXT_RELEASE_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION" + + # # If its a development release, attach the tag accordingly + # if [[ "$IS_DEV_RELEASE" == "true" ]]; then + # NEXT_RELEASE_VERSION="$NEXT_RELEASE_VERSION0-dev.1" + # fi + # fi + + # # Outputting the version as a GH Output + # echo "NEXT_RELEASE_VERSION=$NEXT_RELEASE_VERSION" >> $GITHUB_OUTPUT + + # - id: changelog + # name: Generating Change log from the previous versions if exists for the new release + # run: | + + # # We will output the change log + # # as one big blob of text + # echo "NOTES<> $GITHUB_OUTPUT + + # # Fetching the current release tag if it exists + # # If it does not, we are starting from scratch + # CURRENT_TAG=$(git tag -l "$MODULE/v*" --sort=-v:refname | head -n 1) + # CURRENT_TAG=${CURRENT_TAG:-$(git rev-list --max-parents=0 HEAD)} + + # # Fetch all commits since the previous release for this specific module + # COMMITS=$(it log $CURRENT_TAG..HEAD --format="%H" -- "modules/$MODULE") + + # # Looping across all commits to pull out + # # Change log for the next release + # for SHASUM in $COMMITS; do + # # Fetch the body of the commit + # # Since all commits on the main + # # branch is PRs getting squashed + # # and merged, the body will contain + # # the changes made + # BODY=$(git log -1 --format="%b" $SHASUM) + + # # If the body is garbage, DO NOT INCLUDE + # # IN THE CHANGELOG + # if [[ ! "$BODY" == *"# Implemented Changes"* ]]; then + # continue + # fi + + # # Fetch the commit message + # SUBJECT=$(git log -1 --format="%s" $SHASUM) + + # # If the commit message is for an infrastructure + # # folder update, ignore it safely + # if [[ $SUBJECT == "[INF]"* ]]; then + # continue + # fi + + # # Fetch the PR number from the commit message + # PR_REF=$(echo "$SUBJECT" | grep -o '(#[0-9]\+)' | sed 's/[()]//g' || echo "N/A") + + # # Fetch the issue number from the body of the commit + # CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") + + # # Fetch all the changes made in the body and ignore everything apart from the changes points + # CHANGES=$(echo "$BODY" | sed -n '/# Implemented Changes/,/\*\*Closes:/p' | grep -vE '(# Implemented Changes|\*\*Closes:|^$)' | sed 's/^[[:space:]]*[-*][[:space:]]*//') + + # # Take the changes points and output it as the changelogs + # if [ ! -z "$CHANGES" ]; then + # while read -r line; do echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT; done <<< "$CHANGES" + # fi + + # done + # echo "EOF" >> $GITHUB_OUTPUT + + # - name: Printing out the release information as a step summary for validation + # run: | + # echo "### Release Preview: ${{ inputs.module_name }}" >> $GITHUB_STEP_SUMMARY + # echo "**New Version:** \`${{ steps.version.outputs.NEXT_RELEASE_VERSION }}\`" >> $GITHUB_STEP_SUMMARY + # echo "**Release Type:** ${{ inputs.is_dev_release && 'In Development (Dev)' || 'Stable' }}" >> $GITHUB_STEP_SUMMARY + # echo "#### Proposed Changelogs:" >> $GITHUB_STEP_SUMMARY + # if [ -z "${{ steps.changelog.outputs.NOTES }}" ]; then + # echo "*No descriptive changes found (commits may lack the 'Implemented Changes' section).*" >> $GITHUB_STEP_SUMMARY + # else + # echo "${{ steps.changelog.outputs.NOTES }}" >> $GITHUB_STEP_SUMMARY + # fi + # echo "" >> $GITHUB_STEP_SUMMARY + # echo "> **Note:** Please review the details above. If correct, approve the next job to finalize the release." >> $GITHUB_STEP_SUMMARY From f7f9dc58c11adfe9b68630a4b5383a4ef6e4e20c Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:02:19 +0530 Subject: [PATCH 02/17] ci(deploy): target only infra and module changes --- .github/workflows/tofu-deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tofu-deploy.yaml b/.github/workflows/tofu-deploy.yaml index 2b1517b..10f734d 100644 --- a/.github/workflows/tofu-deploy.yaml +++ b/.github/workflows/tofu-deploy.yaml @@ -3,6 +3,9 @@ name: Infrastructure Deployment on Self Hosted Kubernetes Cluster on: workflow_dispatch: push: + paths: + - infrastructure/** + - modules/** branches: - task/** - bug/** From fa3325bec7ddff053d27ff7ebde855003fd52935 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:02:32 +0530 Subject: [PATCH 03/17] ci(deploy): switch back to on demand --- .github/workflows/releases.yml | 262 ++++++++++++++++----------------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 58d81ad..8c0b8bc 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,7 +1,6 @@ name: Generate GH Release with Proper Release Notes for OpenTofu Modules on: - push: workflow_dispatch: inputs: module_name: @@ -23,6 +22,7 @@ on: jobs: prepare_release_details: + name: Preparing release details such as next release version and changelogs runs-on: ubuntu-latest environment: ${{ inputs.module_name }} env: @@ -36,135 +36,135 @@ jobs: with: fetch-depth: 0 - # - name: Checking if there's anything committed to create a new release - # run: | + - name: Checking if there's anything committed to create a new release + run: | - # # Count commits in the module path excluding [INF] - # CHANGE_COUNT=$(git log $CURRENT_FULL_VERSION..HEAD --oneline -- "modules/$MODULE" | grep -v "\[INF\]" | wc -l) + # Count commits in the module path excluding [INF] + CHANGE_COUNT=$(git log $CURRENT_FULL_VERSION..HEAD --oneline -- "modules/$MODULE" | grep -v "\[INF\]" | wc -l) - # if [ "$CHANGE_COUNT" -eq "0" ]; then - # echo "::error title=No Changes Detected::No non-[INF] commits found in modules/$MODULE since $CURRENT_FULL_VERSION." - # exit 1 - # fi - # echo "Found $CHANGE_COUNT relevant changes." - - # - id: version - # name: Calculating the next release version from the previous if it exists - # run: | - - # # Fetch the raw version without any development tags if it exists - # BASE_VERSION=$(echo "$CURRENT_FULL_VERSION" | cut -d "." -f1) - - # # If the previous release was a development version, extract the release number - # DEV_VERSION=$(echo "$CURRENT_FULL_VERSION" | grep -oP 'dev\.\K\d+' || echo "0") - - # # Calculating the next release version - # # Case 1: if the current release was a dev version and the next one is not, the next - # # release version will be the base version without any dev tags added onto it - # if [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "false" ]]; then - # NEXT_RELEASE_VERSION="$BASE_VERSION" - - # # Case 2: if the current release was a dev version and the next one is also a dev - # # release, the next release version will be the same with the dev version incremented - # elif [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "true" ]]; then - # DEV_VERSION=$(( DEV_VERSION + 1 )) - # NEXT_RELEASE_VERSION="$BASE_VERSION-dev.$DEV_VERSION" - - # # Case 3: if the current release is not a dev version and the next too is not - # # According to the provided inputs, increment major/minor/patch version and - # # make that as the next release version to be performed - # else - # # Split the basen version up using period - # # and extract the individual versions - # IFS='.' read -ra VERSIONS <<< "$BASE_VERSION" - # MAJOR_VERSION=${VERSIONS[0]} - # MINOR_VERSION=${VERSIONS[1]} - # PATCH_VERSION=${VERSIONS[2]} - - # # Increment the version according to the inputs and create the final version - # if [[ "$RELEASE_TYPE" == "major" ]]; then MAJOR_VERSION=$(( MAJOR_VERSION + 1 )); MINOR_VERSION=0; PATCH_VERSION=0; - # elif [[ "$RELEASE_TYPE" == "minor" ]]; then MINOR_VERSION=$(( MINOR_VERSION + 1 )); PATCH_VERSION=0; - # else PATCH_VERSION=$(( PATCH_VERSION + 1 )); fi - - # NEXT_RELEASE_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION" - - # # If its a development release, attach the tag accordingly - # if [[ "$IS_DEV_RELEASE" == "true" ]]; then - # NEXT_RELEASE_VERSION="$NEXT_RELEASE_VERSION0-dev.1" - # fi - # fi - - # # Outputting the version as a GH Output - # echo "NEXT_RELEASE_VERSION=$NEXT_RELEASE_VERSION" >> $GITHUB_OUTPUT - - # - id: changelog - # name: Generating Change log from the previous versions if exists for the new release - # run: | - - # # We will output the change log - # # as one big blob of text - # echo "NOTES<> $GITHUB_OUTPUT - - # # Fetching the current release tag if it exists - # # If it does not, we are starting from scratch - # CURRENT_TAG=$(git tag -l "$MODULE/v*" --sort=-v:refname | head -n 1) - # CURRENT_TAG=${CURRENT_TAG:-$(git rev-list --max-parents=0 HEAD)} - - # # Fetch all commits since the previous release for this specific module - # COMMITS=$(it log $CURRENT_TAG..HEAD --format="%H" -- "modules/$MODULE") - - # # Looping across all commits to pull out - # # Change log for the next release - # for SHASUM in $COMMITS; do - # # Fetch the body of the commit - # # Since all commits on the main - # # branch is PRs getting squashed - # # and merged, the body will contain - # # the changes made - # BODY=$(git log -1 --format="%b" $SHASUM) - - # # If the body is garbage, DO NOT INCLUDE - # # IN THE CHANGELOG - # if [[ ! "$BODY" == *"# Implemented Changes"* ]]; then - # continue - # fi - - # # Fetch the commit message - # SUBJECT=$(git log -1 --format="%s" $SHASUM) - - # # If the commit message is for an infrastructure - # # folder update, ignore it safely - # if [[ $SUBJECT == "[INF]"* ]]; then - # continue - # fi - - # # Fetch the PR number from the commit message - # PR_REF=$(echo "$SUBJECT" | grep -o '(#[0-9]\+)' | sed 's/[()]//g' || echo "N/A") - - # # Fetch the issue number from the body of the commit - # CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") - - # # Fetch all the changes made in the body and ignore everything apart from the changes points - # CHANGES=$(echo "$BODY" | sed -n '/# Implemented Changes/,/\*\*Closes:/p' | grep -vE '(# Implemented Changes|\*\*Closes:|^$)' | sed 's/^[[:space:]]*[-*][[:space:]]*//') - - # # Take the changes points and output it as the changelogs - # if [ ! -z "$CHANGES" ]; then - # while read -r line; do echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT; done <<< "$CHANGES" - # fi - - # done - # echo "EOF" >> $GITHUB_OUTPUT - - # - name: Printing out the release information as a step summary for validation - # run: | - # echo "### Release Preview: ${{ inputs.module_name }}" >> $GITHUB_STEP_SUMMARY - # echo "**New Version:** \`${{ steps.version.outputs.NEXT_RELEASE_VERSION }}\`" >> $GITHUB_STEP_SUMMARY - # echo "**Release Type:** ${{ inputs.is_dev_release && 'In Development (Dev)' || 'Stable' }}" >> $GITHUB_STEP_SUMMARY - # echo "#### Proposed Changelogs:" >> $GITHUB_STEP_SUMMARY - # if [ -z "${{ steps.changelog.outputs.NOTES }}" ]; then - # echo "*No descriptive changes found (commits may lack the 'Implemented Changes' section).*" >> $GITHUB_STEP_SUMMARY - # else - # echo "${{ steps.changelog.outputs.NOTES }}" >> $GITHUB_STEP_SUMMARY - # fi - # echo "" >> $GITHUB_STEP_SUMMARY - # echo "> **Note:** Please review the details above. If correct, approve the next job to finalize the release." >> $GITHUB_STEP_SUMMARY + if [ "$CHANGE_COUNT" -eq "0" ]; then + echo "::error title=No Changes Detected::No non-[INF] commits found in modules/$MODULE since $CURRENT_FULL_VERSION." + exit 1 + fi + echo "Found $CHANGE_COUNT relevant changes." + + - id: version + name: Calculating the next release version from the previous if it exists + run: | + + # Fetch the raw version without any development tags if it exists + BASE_VERSION=$(echo "$CURRENT_FULL_VERSION" | cut -d "." -f1) + + # If the previous release was a development version, extract the release number + DEV_VERSION=$(echo "$CURRENT_FULL_VERSION" | grep -oP 'dev\.\K\d+' || echo "0") + + # Calculating the next release version + # Case 1: if the current release was a dev version and the next one is not, the next + # release version will be the base version without any dev tags added onto it + if [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "false" ]]; then + NEXT_RELEASE_VERSION="$BASE_VERSION" + + # Case 2: if the current release was a dev version and the next one is also a dev + # release, the next release version will be the same with the dev version incremented + elif [[ "$CURRENT_FULL_VERSION" == *"dev."* && "$IS_DEV_RELEASE" == "true" ]]; then + DEV_VERSION=$(( DEV_VERSION + 1 )) + NEXT_RELEASE_VERSION="$BASE_VERSION-dev.$DEV_VERSION" + + # Case 3: if the current release is not a dev version and the next too is not + # According to the provided inputs, increment major/minor/patch version and + # make that as the next release version to be performed + else + # Split the basen version up using period + # and extract the individual versions + IFS='.' read -ra VERSIONS <<< "$BASE_VERSION" + MAJOR_VERSION=${VERSIONS[0]} + MINOR_VERSION=${VERSIONS[1]} + PATCH_VERSION=${VERSIONS[2]} + + # Increment the version according to the inputs and create the final version + if [[ "$RELEASE_TYPE" == "major" ]]; then MAJOR_VERSION=$(( MAJOR_VERSION + 1 )); MINOR_VERSION=0; PATCH_VERSION=0; + elif [[ "$RELEASE_TYPE" == "minor" ]]; then MINOR_VERSION=$(( MINOR_VERSION + 1 )); PATCH_VERSION=0; + else PATCH_VERSION=$(( PATCH_VERSION + 1 )); fi + + NEXT_RELEASE_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION" + + # If its a development release, attach the tag accordingly + if [[ "$IS_DEV_RELEASE" == "true" ]]; then + NEXT_RELEASE_VERSION="$NEXT_RELEASE_VERSION0-dev.1" + fi + fi + + # Outputting the version as a GH Output + echo "NEXT_RELEASE_VERSION=$NEXT_RELEASE_VERSION" >> $GITHUB_OUTPUT + + - id: changelog + name: Generating Change log from the previous versions if exists for the new release + run: | + + # We will output the change log + # as one big blob of text + echo "NOTES<> $GITHUB_OUTPUT + + # Fetching the current release tag if it exists + # If it does not, we are starting from scratch + CURRENT_TAG=$(git tag -l "$MODULE/v*" --sort=-v:refname | head -n 1) + CURRENT_TAG=${CURRENT_TAG:-$(git rev-list --max-parents=0 HEAD)} + + # Fetch all commits since the previous release for this specific module + COMMITS=$(it log $CURRENT_TAG..HEAD --format="%H" -- "modules/$MODULE") + + # Looping across all commits to pull out + # Change log for the next release + for SHASUM in $COMMITS; do + # Fetch the body of the commit + # Since all commits on the main + # branch is PRs getting squashed + # and merged, the body will contain + # the changes made + BODY=$(git log -1 --format="%b" $SHASUM) + + # If the body is garbage, DO NOT INCLUDE + # IN THE CHANGELOG + if [[ ! "$BODY" == *"# Implemented Changes"* ]]; then + continue + fi + + # Fetch the commit message + SUBJECT=$(git log -1 --format="%s" $SHASUM) + + # If the commit message is for an infrastructure + # folder update, ignore it safely + if [[ $SUBJECT == "[INF]"* ]]; then + continue + fi + + # Fetch the PR number from the commit message + PR_REF=$(echo "$SUBJECT" | grep -o '(#[0-9]\+)' | sed 's/[()]//g' || echo "N/A") + + # Fetch the issue number from the body of the commit + CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") + + # Fetch all the changes made in the body and ignore everything apart from the changes points + CHANGES=$(echo "$BODY" | sed -n '/# Implemented Changes/,/\*\*Closes:/p' | grep -vE '(# Implemented Changes|\*\*Closes:|^$)' | sed 's/^[[:space:]]*[-*][[:space:]]*//') + + # Take the changes points and output it as the changelogs + if [ ! -z "$CHANGES" ]; then + while read -r line; do echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT; done <<< "$CHANGES" + fi + + done + echo "EOF" >> $GITHUB_OUTPUT + + - name: Printing out the release information as a step summary for validation + run: | + echo "### Release Preview: ${{ inputs.module_name }}" >> $GITHUB_STEP_SUMMARY + echo "**New Version:** \`${{ steps.version.outputs.NEXT_RELEASE_VERSION }}\`" >> $GITHUB_STEP_SUMMARY + echo "**Release Type:** ${{ inputs.is_dev_release && 'In Development (Dev)' || 'Stable' }}" >> $GITHUB_STEP_SUMMARY + echo "#### Proposed Changelogs:" >> $GITHUB_STEP_SUMMARY + if [ -z "${{ steps.changelog.outputs.NOTES }}" ]; then + echo "*No descriptive changes found (commits may lack the 'Implemented Changes' section).*" >> $GITHUB_STEP_SUMMARY + else + echo "${{ steps.changelog.outputs.NOTES }}" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "> **Note:** Please review the details above. If correct, approve the next job to finalize the release." >> $GITHUB_STEP_SUMMARY From d49939346f5bfd07a2e927bb01b3e9615caaae75 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:18:45 +0530 Subject: [PATCH 04/17] ci(deploy): testing with fetching commits since previous tag or since birth --- .github/workflows/releases.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8c0b8bc..4914b7b 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -39,8 +39,10 @@ jobs: - name: Checking if there's anything committed to create a new release run: | + CURRENT_TAG=$(git tag -l "$MODULE/v*" --sort=-v:refname | head -n 1) + CURRENT_TAG=${CURRENT_TAG:-$(git rev-list --max-parents=0 HEAD)} # Count commits in the module path excluding [INF] - CHANGE_COUNT=$(git log $CURRENT_FULL_VERSION..HEAD --oneline -- "modules/$MODULE" | grep -v "\[INF\]" | wc -l) + CHANGE_COUNT=$(git log $CURRENT_TAG..HEAD --oneline -- "modules/$MODULE" | grep -v "\[INF\]" | wc -l) if [ "$CHANGE_COUNT" -eq "0" ]; then echo "::error title=No Changes Detected::No non-[INF] commits found in modules/$MODULE since $CURRENT_FULL_VERSION." From f4b5a4c301b118bfcc9760876be11ad241e2ee63 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:21:05 +0530 Subject: [PATCH 05/17] ci(deploy): git typo fix --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 4914b7b..c4fc030 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -113,7 +113,7 @@ jobs: CURRENT_TAG=${CURRENT_TAG:-$(git rev-list --max-parents=0 HEAD)} # Fetch all commits since the previous release for this specific module - COMMITS=$(it log $CURRENT_TAG..HEAD --format="%H" -- "modules/$MODULE") + COMMITS=$(git log $CURRENT_TAG..HEAD --format="%H" -- "modules/$MODULE") # Looping across all commits to pull out # Change log for the next release From e5938a05bc7742bb9638e24b58ba158df34aec4e Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:24:58 +0530 Subject: [PATCH 06/17] ci(deploy): handle multiline strings in the commit body --- .github/workflows/releases.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c4fc030..6a72d1b 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -147,11 +147,13 @@ jobs: CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") # Fetch all the changes made in the body and ignore everything apart from the changes points - CHANGES=$(echo "$BODY" | sed -n '/# Implemented Changes/,/\*\*Closes:/p' | grep -vE '(# Implemented Changes|\*\*Closes:|^$)' | sed 's/^[[:space:]]*[-*][[:space:]]*//') + CHANGES=$(echo "$BODY" | awk '/# Implemented Changes/{flag=1; next} /\*\*Closes:/{flag=0} flag' | sed 's/^[[:space:]]*[-*][[:space:]]*//' | sed '/^[[:space:]]*$/d') # Take the changes points and output it as the changelogs if [ ! -z "$CHANGES" ]; then - while read -r line; do echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT; done <<< "$CHANGES" + echo "$CHANGES" | while read -r line; do + echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT + done fi done From ae098ebc55021fa752946bfbc30baf16e474a444 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:27:56 +0530 Subject: [PATCH 07/17] ci(deploy): handle multiline strings in the commit body --- .github/workflows/releases.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 6a72d1b..756fdfd 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -147,13 +147,13 @@ jobs: CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") # Fetch all the changes made in the body and ignore everything apart from the changes points - CHANGES=$(echo "$BODY" | awk '/# Implemented Changes/{flag=1; next} /\*\*Closes:/{flag=0} flag' | sed 's/^[[:space:]]*[-*][[:space:]]*//' | sed '/^[[:space:]]*$/d') + CHANGES=$(echo "$BODY" | awk '/# Implemented Changes/{flag=1; next} /\*\*Closes:/{flag=0} flag' | sed '/^[[:space:]]*$/d') # Take the changes points and output it as the changelogs if [ ! -z "$CHANGES" ]; then - echo "$CHANGES" | while read -r line; do - echo "- $line (PR: $PR_REF, Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT - done + echo "#### From PR: #$PR_REF (Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT + echo "$CHANGES" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT fi done From cae5c113285f8104e8f27c08ec95218ccfcbdf32 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:31:03 +0530 Subject: [PATCH 08/17] ci(deploy): handle multiple issue callouts --- .github/workflows/releases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 756fdfd..8267ee8 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -144,14 +144,14 @@ jobs: PR_REF=$(echo "$SUBJECT" | grep -o '(#[0-9]\+)' | sed 's/[()]//g' || echo "N/A") # Fetch the issue number from the body of the commit - CLOSE_REF=$(echo "$BODY" | grep -o '\*\*Closes: #[0-9]\+\*\*' | grep -o '#[0-9]\+' || echo "N/A") + CLOSE_REF=$(echo "$BODY" | grep -i "Closes:" | sed 's/.*Closes://I' | sed 's/[*]//g' | xargs || echo "N/A") # Fetch all the changes made in the body and ignore everything apart from the changes points CHANGES=$(echo "$BODY" | awk '/# Implemented Changes/{flag=1; next} /\*\*Closes:/{flag=0} flag' | sed '/^[[:space:]]*$/d') # Take the changes points and output it as the changelogs if [ ! -z "$CHANGES" ]; then - echo "#### From PR: #$PR_REF (Closes: $CLOSE_REF)" >> $GITHUB_OUTPUT + echo "#### From PR: #$PR_REF (Issues closed: $CLOSE_REF)" >> $GITHUB_OUTPUT echo "$CHANGES" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT fi From 2ea41b91bf33abbc5672709d83f5c54f57e980ca Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:34:25 +0530 Subject: [PATCH 09/17] ci(deploy): handle missing issue numbers --- .github/workflows/releases.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8267ee8..5547350 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -145,6 +145,7 @@ jobs: # Fetch the issue number from the body of the commit CLOSE_REF=$(echo "$BODY" | grep -i "Closes:" | sed 's/.*Closes://I' | sed 's/[*]//g' | xargs || echo "N/A") + CLOSE_REF=${CLOSE_REF:-"N/A"} # Fetch all the changes made in the body and ignore everything apart from the changes points CHANGES=$(echo "$BODY" | awk '/# Implemented Changes/{flag=1; next} /\*\*Closes:/{flag=0} flag' | sed '/^[[:space:]]*$/d') From 53ef7b4bbf9c790c64773cfe71828872f6e03e6a Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:41:48 +0530 Subject: [PATCH 10/17] ci(deploy): base version fix --- .github/workflows/releases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 5547350..fb9d101 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -55,7 +55,7 @@ jobs: run: | # Fetch the raw version without any development tags if it exists - BASE_VERSION=$(echo "$CURRENT_FULL_VERSION" | cut -d "." -f1) + BASE_VERSION=$(echo "$CURRENT_FULL_VERSION" | cut -d- -f1) # If the previous release was a development version, extract the release number DEV_VERSION=$(echo "$CURRENT_FULL_VERSION" | grep -oP 'dev\.\K\d+' || echo "0") @@ -92,7 +92,7 @@ jobs: # If its a development release, attach the tag accordingly if [[ "$IS_DEV_RELEASE" == "true" ]]; then - NEXT_RELEASE_VERSION="$NEXT_RELEASE_VERSION0-dev.1" + NEXT_RELEASE_VERSION="$NEXT_RELEASE_VERSION-dev.1" fi fi From cec0c8514d3031f16d12bc169e678796ed3207d2 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:55:19 +0530 Subject: [PATCH 11/17] ci(deploy): integrating gh releases --- .github/workflows/releases.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index fb9d101..233a1af 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -30,6 +30,9 @@ jobs: RELEASE_TYPE: ${{ inputs.release_type }} IS_DEV_RELEASE: ${{ inputs.is_dev_release }} CURRENT_FULL_VERSION: ${{ vars.FULL_VERSION || '0.0.0' }} + outputs: + version: ${{ steps.version.outputs.NEXT_RELEASE_VERSION }} + changelog: ${{ steps.changelog.outputs.NOTES }} steps: - name: Checking out the repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd @@ -173,3 +176,30 @@ jobs: fi echo "" >> $GITHUB_STEP_SUMMARY echo "> **Note:** Please review the details above. If correct, approve the next job to finalize the release." >> $GITHUB_STEP_SUMMARY + + perform_release: + name: Create the release for the ${{ inputs.module_name }} module + runs-on: ubuntu-latest + environment: "manual-approval" + needs: prepare_release_details + env: + version: ${{ needs.prepare_release_details.outputs.version }} + changelog: ${{ needs.prepare_release_details.outputs.changelog }} + permissions: + contents: write + steps: + - name: Finalize the release version in GitHub Environment for ${{ inputs.module_name }} + env: + GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} + run: gh variable set MODULE_VERSION --body "${{ env.version }}" --env "${{ inputs.module_name }}" + + - name: Create GitHub Release for the ${{ inputs.module_name }} + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe + with: + tag_name: ${{ env.version }} + name: ${{ inputs.module_name }} v${{ env.version }} + body: | + ## Changes in ${{ github.event.inputs.module_name }} + ${{ env.changelog }} + prerelease: ${{ inputs.is_dev_release }} + make_latest: ${{ inputs.is_dev_release == 'false' }} From 977d5b9f319e8b04cd7160a9b0c22881ef1164f9 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 12:58:14 +0530 Subject: [PATCH 12/17] ci(deploy): checkout the repo for release --- .github/workflows/releases.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 233a1af..0ef6140 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -188,6 +188,11 @@ jobs: permissions: contents: write steps: + - name: Checking out the repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 + - name: Finalize the release version in GitHub Environment for ${{ inputs.module_name }} env: GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} From 842c4c5f882a23f9748826793bff3e9c9a41dde2 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 13:00:36 +0530 Subject: [PATCH 13/17] ci(releases): passing the releases token to the release action --- .github/workflows/releases.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 0ef6140..0bb180c 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -208,3 +208,5 @@ jobs: ${{ env.changelog }} prerelease: ${{ inputs.is_dev_release }} make_latest: ${{ inputs.is_dev_release == 'false' }} + env: + GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} From 36609aa556c3831453f54c367848798aeb5396e5 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 13:05:29 +0530 Subject: [PATCH 14/17] ci(releases): token env mapping fix --- .github/workflows/releases.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 0bb180c..1ca7000 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -195,7 +195,7 @@ jobs: - name: Finalize the release version in GitHub Environment for ${{ inputs.module_name }} env: - GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }} run: gh variable set MODULE_VERSION --body "${{ env.version }}" --env "${{ inputs.module_name }}" - name: Create GitHub Release for the ${{ inputs.module_name }} @@ -208,5 +208,3 @@ jobs: ${{ env.changelog }} prerelease: ${{ inputs.is_dev_release }} make_latest: ${{ inputs.is_dev_release == 'false' }} - env: - GH_TOKEN: ${{ secrets.RELEASES_TOKEN }} From 4072a0f8ca50a6e4dde60140bf7823ec52537430 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 13:10:02 +0530 Subject: [PATCH 15/17] ci(releases): extra hashtag --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 1ca7000..2a5230a 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -155,7 +155,7 @@ jobs: # Take the changes points and output it as the changelogs if [ ! -z "$CHANGES" ]; then - echo "#### From PR: #$PR_REF (Issues closed: $CLOSE_REF)" >> $GITHUB_OUTPUT + echo "#### From PR: $PR_REF (Issues closed: $CLOSE_REF)" >> $GITHUB_OUTPUT echo "$CHANGES" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT fi From c7f165ee133007b8c08d5384e99f26f4245d2585 Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 13:15:06 +0530 Subject: [PATCH 16/17] ci(releases): tagging fix --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 2a5230a..e3cdd8b 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -201,7 +201,7 @@ jobs: - name: Create GitHub Release for the ${{ inputs.module_name }} uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe with: - tag_name: ${{ env.version }} + tag_name: ${{ inputs.module_name }}/v${{ env.version }} name: ${{ inputs.module_name }} v${{ env.version }} body: | ## Changes in ${{ github.event.inputs.module_name }} From 7b6d2cabf450de106011b53e51e1e80dbbe5c09b Mon Sep 17 00:00:00 2001 From: khatrivarun Date: Tue, 24 Mar 2026 13:23:21 +0530 Subject: [PATCH 17/17] ci(releases): permissions --- .github/workflows/releases.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index e3cdd8b..75fff78 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -33,6 +33,8 @@ jobs: outputs: version: ${{ steps.version.outputs.NEXT_RELEASE_VERSION }} changelog: ${{ steps.changelog.outputs.NOTES }} + permissions: + contents: read steps: - name: Checking out the repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd