From dd79f762311d484ec52180d786f72dde150f71d6 Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Sun, 9 Mar 2025 23:40:09 +0530 Subject: [PATCH 1/8] Update create-release.yml --- .github/workflows/create-release.yml | 112 +++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 17 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 14d1400a59..002b949cd8 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -1,18 +1,100 @@ -# This workflow is used to create a github release from last tag pushed +# This workflow is used to create tag and Release for OSS name: Create Release # Controls when the action will run. Workflow runs when manually triggered using the UI # or on push in charts directory of main branch. on: - workflow_dispatch: + inputs: + RELEASE_TYPE: + description: 'Release type (major/minor/patch/beta)' + required: true + type: choice + options: + - major + - minor + - patch + - beta # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "create-release" + + create-release-tag: + runs-on: ubuntu-latest + container: + image: alpine:latest + + env: + GITHUB_TOKENS: ${{ secrets.GH_SYSTEMSDT_TOKEN }} + GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }} + GIT_CONFIG_NAME: ${{ secrets.GH_SYSTEMSDT_USERNAME }} + GIT_USERNAME: ${{ secrets.GH_SYSTEMSDT_USERNAME }} + GIT_REPO: ${{ github.repository }} + RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }} + REPO: https://github.com/akshatsinha007/devtron + RELEASE_BRANCH: "main" + + steps: + - name: Install dependencies + run: | + apk update && apk add --no-cache git github-cli + + - name: Configure Git + run: | + echo $GITHUB_TOKENS > tokens.txt + gh auth login --with-token < tokens.txt + git config --global user.email "$GIT_CONFIG_EMAIL" + git config --global user.name "$GIT_CONFIG_NAME" + + - name: Clone repository and create tag + run: | + mkdir preci && cd preci + gh repo clone "$REPO" + cd $(basename "$REPO") + git checkout $RELEASE_BRANCH + git pull origin $RELEASE_BRANCH + NEXT_RELEASE_VERSION=v$(curl -s https://raw.githubusercontent.com/devtron-labs/charts/refs/heads/main/charts/devtron/Chart.yaml | grep 'appVersion' | awk '{print $2}') + # Create and push tag + git tag $NEXT_RELEASE_VERSION + git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO $NEXT_RELEASE_VERSION + + - name: Update release notes + run: | + cd preci/$(basename "$REPO") + + if [[ "$RELEASE_TYPE" == "beta" ]]; then + # For beta releases, just commit and push all changes + git add . + git commit -m "Updated release-notes files" + git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO --all + else + # For major/minor/patch releases, perform full release notes update + echo -e "## $NEXT_RELEASE_VERSION\n" > tmp + if [ -f beta-releasenotes.md ]; then + cat beta-releasenotes.md >> tmp + echo -e "\n" >> tmp + fi + if [ -f releasenotes.md ]; then + cat releasenotes.md >> tmp + fi + mv tmp releasenotes.md + + # Remove beta release notes + rm -f beta-releasenotes.md + + # Create changelog file + mkdir -p CHANGELOG + cat releasenotes.md > CHANGELOG/release-notes-${NEXT_RELEASE_VERSION}.md + + # Commit and push changes + git add . + git commit -m "Updated release-notes files" + git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO $RELEASE_BRANCH + fi + create-release: - # The type of runner that the job will run on + needs: create-release-tag runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job @@ -20,14 +102,14 @@ jobs: # Runs series of commands to create a release - name: create-release run: | - RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_BRANCH}/manifests/release.txt" ) - RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}') FILE_NAME=${FILE_NAME:=releasenotes.md} echo $RELEASE_TYPE echo $GITHUB_REPOSITORY + echo $RELEASE_BRANCH + gh repo clone $GITHUB_REPOSITORY cd devtron - if [[ "$RELEASE_TYPE" == "stable" ]] + if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch" ]] then tag=$(git tag --sort=committerdate | tail -1) echo $tag @@ -39,11 +121,9 @@ jobs: git config --global user.name "$GIT_CONFIG_NAME" rm -f $FILE_NAME touch $FILE_NAME - echo "## Bugs" > beta-releasenotes.md echo "## Enhancements" >> beta-releasenotes.md - echo "## Documentation" >> beta-releasenotes.md + echo "## Bugs" > beta-releasenotes.md echo "## Others" >> beta-releasenotes.md - echo "beta -1 $tag" > manifests/release.txt git add . git commit -am "Updated release-notes files" git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot @@ -52,9 +132,8 @@ jobs: git checkout -b release-bot git config --global user.email "$GIT_CONFIG_EMAIL" git config --global user.name "$GIT_CONFIG_NAME" - echo "## Bugs" > beta-releasenotes.md echo "## Enhancements" >> beta-releasenotes.md - echo "## Documentation" >> beta-releasenotes.md + echo "## Bugs" > beta-releasenotes.md echo "## Others" >> beta-releasenotes.md git add . git commit -am "Created release-notes files" @@ -62,16 +141,15 @@ jobs: echo "Not creating release due to beta" fi env: + RELEASE_BRANCH: "main" GH_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} - RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }} GIT_CONFIG_NAME: ${{ vars.GH_SYSTEMSDT_USERNAME }} GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }} + RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} # Send notification on discord - name: discord-notify run: | - RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_BRANCH}/manifests/release.txt" ) - RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}') - if [[ "$RELEASE_TYPE" == "stable" ]] + if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch" ]] then sudo apt install python3 python3-pip -y pip install discord-webhook @@ -85,4 +163,4 @@ jobs: echo "Not sending notification due to beta" fi env: - RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }} + RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} From 0c1e5abfa204c98c532e03d3842bd748cf7b0048 Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Sun, 9 Mar 2025 23:44:00 +0530 Subject: [PATCH 2/8] Updated chart-sync.yaml --- .github/workflows/chart-sync.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/chart-sync.yaml b/.github/workflows/chart-sync.yaml index b353974e41..0f145fdfba 100644 --- a/.github/workflows/chart-sync.yaml +++ b/.github/workflows/chart-sync.yaml @@ -2,15 +2,16 @@ name: chart-sync # Controls when the workflow will run on: - # Triggers the workflow on publishing new release on main branch and in charts directory only - push: - branches: - - 'main' - paths: - - 'charts/**' - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - + inputs: + RELEASE_TYPE: + description: 'Release Type' + required: true + default: 'minor' + NEXT_RELEASE_VERSION: + description: 'Release TAG' + required: true + default: 'v1.4.0' # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" @@ -22,7 +23,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: devtron-labs/git-repo-sync@master + - uses: akshatsinha007/git-repo-sync@master with: script-file: ${{ secrets.CHART_SYNC_SCRIPT_FILE }} git-target-repo: ${{ secrets.GIT_TARGET_REPO }} @@ -34,3 +35,5 @@ jobs: git-source-dir: ${{ secrets.GIT_SOURCE_DIR }} working-dir: ${{ secrets.WORKING_DIR }} RELEASE_BRANCH: "main" + RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} + RELEASE_TAG: ${{ github.event.inputs.NEXT_RELEASE_VERSION }} From b95450deac61b06f96f2f1e829de43ae313aa146 Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Sun, 9 Mar 2025 23:52:27 +0530 Subject: [PATCH 3/8] Update chart-sync.yaml --- .github/workflows/chart-sync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-sync.yaml b/.github/workflows/chart-sync.yaml index 0f145fdfba..ca37ad70b0 100644 --- a/.github/workflows/chart-sync.yaml +++ b/.github/workflows/chart-sync.yaml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: akshatsinha007/git-repo-sync@master + - uses: devtron-labs/git-repo-sync@master with: script-file: ${{ secrets.CHART_SYNC_SCRIPT_FILE }} git-target-repo: ${{ secrets.GIT_TARGET_REPO }} From a4bb22eb0c40fbd98a223c3b145d4f7c4b93d62f Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:41:50 +0530 Subject: [PATCH 4/8] Update create-release.yml --- .github/workflows/create-release.yml | 70 ++++++---------------------- 1 file changed, 14 insertions(+), 56 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 002b949cd8..4fa70bb31d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -6,24 +6,12 @@ name: Create Release # or on push in charts directory of main branch. on: workflow_dispatch: - inputs: - RELEASE_TYPE: - description: 'Release type (major/minor/patch/beta)' - required: true - type: choice - options: - - major - - minor - - patch - - beta # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: create-release-tag: runs-on: ubuntu-latest - container: - image: alpine:latest env: GITHUB_TOKENS: ${{ secrets.GH_SYSTEMSDT_TOKEN }} @@ -31,14 +19,10 @@ jobs: GIT_CONFIG_NAME: ${{ secrets.GH_SYSTEMSDT_USERNAME }} GIT_USERNAME: ${{ secrets.GH_SYSTEMSDT_USERNAME }} GIT_REPO: ${{ github.repository }} - RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }} - REPO: https://github.com/akshatsinha007/devtron + REPO: https://github.com/devtron-labs/devtron RELEASE_BRANCH: "main" steps: - - name: Install dependencies - run: | - apk update && apk add --no-cache git github-cli - name: Configure Git run: | @@ -58,40 +42,6 @@ jobs: # Create and push tag git tag $NEXT_RELEASE_VERSION git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO $NEXT_RELEASE_VERSION - - - name: Update release notes - run: | - cd preci/$(basename "$REPO") - - if [[ "$RELEASE_TYPE" == "beta" ]]; then - # For beta releases, just commit and push all changes - git add . - git commit -m "Updated release-notes files" - git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO --all - else - # For major/minor/patch releases, perform full release notes update - echo -e "## $NEXT_RELEASE_VERSION\n" > tmp - if [ -f beta-releasenotes.md ]; then - cat beta-releasenotes.md >> tmp - echo -e "\n" >> tmp - fi - if [ -f releasenotes.md ]; then - cat releasenotes.md >> tmp - fi - mv tmp releasenotes.md - - # Remove beta release notes - rm -f beta-releasenotes.md - - # Create changelog file - mkdir -p CHANGELOG - cat releasenotes.md > CHANGELOG/release-notes-${NEXT_RELEASE_VERSION}.md - - # Commit and push changes - git add . - git commit -m "Updated release-notes files" - git push -f https://$GIT_USERNAME:$GITHUB_TOKENS@github.com/$GIT_REPO $RELEASE_BRANCH - fi create-release: needs: create-release-tag @@ -106,7 +56,12 @@ jobs: echo $RELEASE_TYPE echo $GITHUB_REPOSITORY echo $RELEASE_BRANCH - + version=$(curl -s https://raw.githubusercontent.com/devtron-labs/devtron/refs/heads/main/charts/devtron/Chart.yaml | grep "appVersion" | awk -F ': ' '{print $2}' ) + if [[ "$version" == *"-rc"* ]]; then + RELEASE_TYPE="beta" + else + RELEASE_TYPE="minor" + fi gh repo clone $GITHUB_REPOSITORY cd devtron if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch" ]] @@ -123,7 +78,6 @@ jobs: touch $FILE_NAME echo "## Enhancements" >> beta-releasenotes.md echo "## Bugs" > beta-releasenotes.md - echo "## Others" >> beta-releasenotes.md git add . git commit -am "Updated release-notes files" git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot @@ -134,7 +88,6 @@ jobs: git config --global user.name "$GIT_CONFIG_NAME" echo "## Enhancements" >> beta-releasenotes.md echo "## Bugs" > beta-releasenotes.md - echo "## Others" >> beta-releasenotes.md git add . git commit -am "Created release-notes files" git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot @@ -145,10 +98,15 @@ jobs: GH_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} GIT_CONFIG_NAME: ${{ vars.GH_SYSTEMSDT_USERNAME }} GIT_CONFIG_EMAIL: ${{ secrets.GH_SYSTEMSDT_EMAIL }} - RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} # Send notification on discord - name: discord-notify run: | + version=$(curl -s https://raw.githubusercontent.com/devtron-labs/devtron/refs/heads/main/charts/devtron/Chart.yaml | grep "appVersion" | awk -F ': ' '{print $2}' ) + if [[ "$version" == *"-rc"* ]]; then + RELEASE_TYPE="beta" + else + RELEASE_TYPE="minor" + fi if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch" ]] then sudo apt install python3 python3-pip -y @@ -163,4 +121,4 @@ jobs: echo "Not sending notification due to beta" fi env: - RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} + RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }} From 8df5d6f41276bee4e259d36224dc0b82b64a2389 Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:43:06 +0530 Subject: [PATCH 5/8] Update chart-sync.yaml --- .github/workflows/chart-sync.yaml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/chart-sync.yaml b/.github/workflows/chart-sync.yaml index ca37ad70b0..ee921efee4 100644 --- a/.github/workflows/chart-sync.yaml +++ b/.github/workflows/chart-sync.yaml @@ -2,16 +2,15 @@ name: chart-sync # Controls when the workflow will run on: + # Triggers the workflow on publishing new release on main branch and in charts directory only + push: + branches: + - 'main' + paths: + - 'charts/**' + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - inputs: - RELEASE_TYPE: - description: 'Release Type' - required: true - default: 'minor' - NEXT_RELEASE_VERSION: - description: 'Release TAG' - required: true - default: 'v1.4.0' + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" @@ -23,7 +22,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: devtron-labs/git-repo-sync@master + - uses: akshatsinha007/git-repo-sync@master with: script-file: ${{ secrets.CHART_SYNC_SCRIPT_FILE }} git-target-repo: ${{ secrets.GIT_TARGET_REPO }} @@ -35,5 +34,3 @@ jobs: git-source-dir: ${{ secrets.GIT_SOURCE_DIR }} working-dir: ${{ secrets.WORKING_DIR }} RELEASE_BRANCH: "main" - RELEASE_TYPE: ${{ github.event.inputs.RELEASE_TYPE }} - RELEASE_TAG: ${{ github.event.inputs.NEXT_RELEASE_VERSION }} From cc701e6f190b97703f2f38cc9381aa5eaaeea31f Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:43:35 +0530 Subject: [PATCH 6/8] Update chart-sync.yaml --- .github/workflows/chart-sync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-sync.yaml b/.github/workflows/chart-sync.yaml index ee921efee4..b353974e41 100644 --- a/.github/workflows/chart-sync.yaml +++ b/.github/workflows/chart-sync.yaml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: akshatsinha007/git-repo-sync@master + - uses: devtron-labs/git-repo-sync@master with: script-file: ${{ secrets.CHART_SYNC_SCRIPT_FILE }} git-target-repo: ${{ secrets.GIT_TARGET_REPO }} From 0e42e76a715c6b3cf20d1a61ed920e39d4dc017c Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:06:26 +0530 Subject: [PATCH 7/8] Update create-release.yml --- .github/workflows/create-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4fa70bb31d..6c12f858bf 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -120,5 +120,3 @@ jobs: then echo "Not sending notification due to beta" fi - env: - RELEASE_BRANCH: ${{ secrets.RELEASE_BRANCH }} From f5f3956e17364384ee9876eb9ad1afc4d5986fee Mon Sep 17 00:00:00 2001 From: akshatsinha007 <156403098+akshatsinha007@users.noreply.github.com> Date: Thu, 8 May 2025 17:38:33 +0530 Subject: [PATCH 8/8] Update create-release.yml --- .github/workflows/create-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 6c12f858bf..4510e750a8 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -78,6 +78,7 @@ jobs: touch $FILE_NAME echo "## Enhancements" >> beta-releasenotes.md echo "## Bugs" > beta-releasenotes.md + echo "## Others" >> beta-releasenotes.md git add . git commit -am "Updated release-notes files" git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot @@ -88,6 +89,7 @@ jobs: git config --global user.name "$GIT_CONFIG_NAME" echo "## Enhancements" >> beta-releasenotes.md echo "## Bugs" > beta-releasenotes.md + echo "## Others" >> beta-releasenotes.md git add . git commit -am "Created release-notes files" git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot