From 1e557f00c3d01d40ae785daf5c7c5425ad67c846 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <107089376+rajeshkio@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:45:36 +0530 Subject: [PATCH 01/17] feat: automatically update the appVersion in Chart when release new version (#596) #547 ## What type of PR is this? /kind feature ## What this PR does / why we need it: Governance: Automatically update the appVersion in the Chart when released ## Which issue(s) this PR fixes: Fixes #547 --- .github/workflows/release.yaml | 80 +++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 01f04888..f0cc5922 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,35 +83,6 @@ jobs: id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' - - - name: Install npm packages and build UI - working-directory: ./ui - run: | - npm install - # Using 'CI=false' prevents build errors due to warnings. - # It bypasses the 'process.env.CI = true' setting in CI environments - # that treats warnings as errors, ensuring a successful build. - CI=false npm run build - touch build/.gitkeep - - name: Determine GoReleaser Config with Regex run: | tag=${GITHUB_REF#refs/tags/} @@ -130,11 +101,48 @@ jobs: exit 1 fi - - name: Release the karpor with GoReleaser - uses: goreleaser/goreleaser-action@v2 + - name: Get new chart version from the chart repo + id: get_chart_version + run: | + helm repo add kusionstack https://kusionstack.github.io/charts + helm repo update + version=$(helm search repo kusionstack/karpor --versions | head -n 2 | tail -n 1 | awk '{print $2}') + if [ -z "$version" ]; then + echo "Error: Unable to fetch chart version" >&2 + exit 1 + fi + echo "Current chart version is: $version" + major=$(echo "$version" | cut -d. -f1) + minor=$(echo "$version" | cut -d. -f2) + patch=$(echo "$version" | cut -d. -f3) + new_chart_version="${major}.${minor}.$((patch + 1))" + echo "New chart version is: $new_chart_version" + echo "::set-output name=new_chart_version::$new_chart_version" + + - name: Checkout Target repository + uses: actions/checkout@v3 with: - distribution: goreleaser - version: latest - args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + repository: KusionStack/charts + path: charts + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Bump version in the related HelmChart Chart.yaml + uses: fjogeleit/yaml-update-action@main + with: + repository: KusionStack/charts + valueFile: 'charts/karpor/Chart.yaml' + changes: '{"version":"${{ steps.get_chart_version.outputs.new_chart_version }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}' + value: ${{ steps.get_version.outputs.VERSION }} + branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} + targetBranch: chart-version-updater + createPR: false + message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}' + token: ${{ secrets.GITHUB_TOKEN }} + workDir: charts + + - name: Log Test Outputs # Log outputs for debugging + run: | + echo "Testing complete. Check the logs for details." + echo "New chart version: ${{ steps.get_chart_version.outputs.new_chart_version }}" + echo "App version: ${{ steps.get_version.outputs.VERSION }}" + From 3af7188f3bbd78137dbc99ac4c17cc57e9347662 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Wed, 28 Aug 2024 17:53:59 +0800 Subject: [PATCH 02/17] chore: remove goreleaser job for testing --- .github/workflows/release.yaml | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f0cc5922..86661358 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,23 +83,23 @@ jobs: id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Determine GoReleaser Config with Regex - run: | - tag=${GITHUB_REF#refs/tags/} - alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' - release='v[0-9]+.[0-9]+.[0-9]+' - if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then - echo "Match found for alpha or beta tag" - echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV - elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then - echo "Match found for rc or release tag" - echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV - else - echo "No match found" - exit 1 - fi + # - name: Determine GoReleaser Config with Regex + # run: | + # tag=${GITHUB_REF#refs/tags/} + # alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + # beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + # rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + # release='v[0-9]+.[0-9]+.[0-9]+' + # if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then + # echo "Match found for alpha or beta tag" + # echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV + # elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then + # echo "Match found for rc or release tag" + # echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV + # else + # echo "No match found" + # exit 1 + # fi - name: Get new chart version from the chart repo id: get_chart_version @@ -122,8 +122,8 @@ jobs: - name: Checkout Target repository uses: actions/checkout@v3 with: - repository: KusionStack/charts - path: charts + repository: KusionStack/charts + path: charts token: ${{ secrets.GITHUB_TOKEN }} - name: Bump version in the related HelmChart Chart.yaml @@ -134,7 +134,7 @@ jobs: changes: '{"version":"${{ steps.get_chart_version.outputs.new_chart_version }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}' value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} - targetBranch: chart-version-updater + targetBranch: chart-version-updater createPR: false message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}' token: ${{ secrets.GITHUB_TOKEN }} @@ -145,4 +145,4 @@ jobs: echo "Testing complete. Check the logs for details." echo "New chart version: ${{ steps.get_chart_version.outputs.new_chart_version }}" echo "App version: ${{ steps.get_version.outputs.VERSION }}" - + From d8508ac0f85af3b1ad691b54610c37f9f2f951d1 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Wed, 28 Aug 2024 17:55:52 +0800 Subject: [PATCH 03/17] chore: add pull-requests permission --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 86661358..95bf568b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,6 +10,7 @@ on: - 'v[0-9]+.[0-9]+.[0-9]+' permissions: contents: write + pull-requests: write jobs: Test: name: Unit Test From 5f95441f7dc814b6fdc8a992939bb48fe609cfbf Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 11:28:30 +0800 Subject: [PATCH 04/17] chore: copy latest release.yml on main --- .github/workflows/release.yaml | 108 ++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 95bf568b..3862e440 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,12 +18,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Set up Go 1.22 + uses: actions/setup-go@v5 with: - fetch-depth: 0 - - name: Set up Go 1.19 - uses: actions/setup-go@v2 - with: - go-version: 1.19 + go-version: '1.22' - name: Running go tests with coverage env: GO111MODULE: on @@ -35,24 +33,25 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go 1.19 + - name: Set up Go 1.22 uses: actions/setup-go@v5 with: - go-version: 1.19 - # NOTE: This golangci-lint action MUST be specified as v2 version, otherwise an error will be reported: - # Running error: can't run linter goanalysis_metalinter\nbuildssa: failed to load package main: could - # not load export data: no export data for \"k8s.io/kube-aggregator\" + go-version: '1.22' - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v6 with: - version: v1.58.2 + version: v1.62.0 + skip-cache: true + args: > + --timeout=10m + --verbose + --max-issues-per-linter=0 + --max-same-issues=0 - # # Lints Pull Request commits with commitlint. - # # - # # Rules can be referenced: - # # https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional + # Lints Pull Request commits with commitlint. + # + # Rules can be referenced: + # https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional CommitLint: name: Commit Lint runs-on: ubuntu-latest @@ -84,23 +83,61 @@ jobs: id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # - name: Determine GoReleaser Config with Regex - # run: | - # tag=${GITHUB_REF#refs/tags/} - # alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - # beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - # rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' - # release='v[0-9]+.[0-9]+.[0-9]+' - # if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then - # echo "Match found for alpha or beta tag" - # echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV - # elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then - # echo "Match found for rc or release tag" - # echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV - # else - # echo "No match found" - # exit 1 - # fi + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install npm packages and build UI + working-directory: ./ui + run: | + npm install + # Using 'CI=false' prevents build errors due to warnings. + # It bypasses the 'process.env.CI = true' setting in CI environments + # that treats warnings as errors, ensuring a successful build. + CI=false npm run build + touch build/.gitkeep + + - name: Determine GoReleaser Config with Regex + run: | + tag=${GITHUB_REF#refs/tags/} + alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + release='v[0-9]+.[0-9]+.[0-9]+' + if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then + echo "Match found for alpha or beta tag" + echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV + elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then + echo "Match found for rc or release tag" + echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV + else + echo "No match found" + exit 1 + fi + + - name: Release the karpor with GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get new chart version from the chart repo id: get_chart_version @@ -146,4 +183,3 @@ jobs: echo "Testing complete. Check the logs for details." echo "New chart version: ${{ steps.get_chart_version.outputs.new_chart_version }}" echo "App version: ${{ steps.get_version.outputs.VERSION }}" - From 8bd32b4344f5b854bd6bbda9e4254137580587b1 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 11:31:26 +0800 Subject: [PATCH 05/17] chore: bump checkout version v3=>v4 --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3862e440..afa00e8c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -158,7 +158,7 @@ jobs: echo "::set-output name=new_chart_version::$new_chart_version" - name: Checkout Target repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: KusionStack/charts path: charts From e52511375f3c5d65a91bf1540a11b45e1c53d6bc Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 11:38:00 +0800 Subject: [PATCH 06/17] chore: comment test code --- .github/workflows/release.yaml | 102 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index afa00e8c..d1e5622f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,61 +83,61 @@ jobs: id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Login to Docker Hub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v2 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 + # - name: Set up Go + # uses: actions/setup-go@v5 + # with: + # go-version: '1.22' + # - name: Set up Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: '20' - - name: Install npm packages and build UI - working-directory: ./ui - run: | - npm install - # Using 'CI=false' prevents build errors due to warnings. - # It bypasses the 'process.env.CI = true' setting in CI environments - # that treats warnings as errors, ensuring a successful build. - CI=false npm run build - touch build/.gitkeep + # - name: Install npm packages and build UI + # working-directory: ./ui + # run: | + # npm install + # # Using 'CI=false' prevents build errors due to warnings. + # # It bypasses the 'process.env.CI = true' setting in CI environments + # # that treats warnings as errors, ensuring a successful build. + # CI=false npm run build + # touch build/.gitkeep - - name: Determine GoReleaser Config with Regex - run: | - tag=${GITHUB_REF#refs/tags/} - alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' - release='v[0-9]+.[0-9]+.[0-9]+' - if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then - echo "Match found for alpha or beta tag" - echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV - elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then - echo "Match found for rc or release tag" - echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV - else - echo "No match found" - exit 1 - fi + # - name: Determine GoReleaser Config with Regex + # run: | + # tag=${GITHUB_REF#refs/tags/} + # alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + # beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + # rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + # release='v[0-9]+.[0-9]+.[0-9]+' + # if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then + # echo "Match found for alpha or beta tag" + # echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV + # elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then + # echo "Match found for rc or release tag" + # echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV + # else + # echo "No match found" + # exit 1 + # fi - - name: Release the karpor with GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Release the karpor with GoReleaser + # uses: goreleaser/goreleaser-action@v2 + # with: + # distribution: goreleaser + # version: latest + # args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get new chart version from the chart repo id: get_chart_version From 6d2fc27a82fbc4af44e4226c5bb386f9a25a70cf Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 12:20:55 +0800 Subject: [PATCH 07/17] chore: use CHART_UPDATER_PAT on chart-updater steps --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d1e5622f..4bbd5aef 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -162,7 +162,7 @@ jobs: with: repository: KusionStack/charts path: charts - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.CHART_UPDATER_PAT }} - name: Bump version in the related HelmChart Chart.yaml uses: fjogeleit/yaml-update-action@main @@ -175,7 +175,7 @@ jobs: targetBranch: chart-version-updater createPR: false message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}' - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.CHART_UPDATER_PAT }} workDir: charts - name: Log Test Outputs # Log outputs for debugging From f35f035e730e6c4c5f74d3a0f2bdcac4fd14e922 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:09:09 +0800 Subject: [PATCH 08/17] fix: invalid config of yaml-update-action --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4bbd5aef..ce95511d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -172,9 +172,9 @@ jobs: changes: '{"version":"${{ steps.get_chart_version.outputs.new_chart_version }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}' value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} - targetBranch: chart-version-updater - createPR: false - message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}' + targetBranch: master + createPR: true + message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' token: ${{ secrets.CHART_UPDATER_PAT }} workDir: charts From bb17a45977678a7305b72450f8fd1ab561321224 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:11:39 +0800 Subject: [PATCH 09/17] fix: missing fetch-depth --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ce95511d..e3fe5c52 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -163,6 +163,7 @@ jobs: repository: KusionStack/charts path: charts token: ${{ secrets.CHART_UPDATER_PAT }} + fetch-depth: 0 - name: Bump version in the related HelmChart Chart.yaml uses: fjogeleit/yaml-update-action@main From 750e88af3d723e9383b76e620b85bbe66ccfa336 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:25:11 +0800 Subject: [PATCH 10/17] chore: refine yaml-update-action config --- .github/workflows/release.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e3fe5c52..2d3454a4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -174,9 +174,20 @@ jobs: value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} targetBranch: master - createPR: true message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' + createPR: true + title: '{{message}}' + description: | + This PR updates the Karpor Helm chart with the following changes: + - Bump the `appVersion` to ${{ steps.get_version.outputs.VERSION }} + - Bump the `version` to ${{ steps.get_chart_version.outputs.new_chart_version }} + + These updates ensure that the chart reflects the latest Karpor release. + + **Note**: This PR was automatically generated by the **karpor-chart-updater[bot]**. + labels: 'karpor-chart-updater[bot]' token: ${{ secrets.CHART_UPDATER_PAT }} + commitUserName: 'karpor-chart-updater[bot]' workDir: charts - name: Log Test Outputs # Log outputs for debugging From 79af8aa105f8a03cf82037f57fc161aff9603387 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:31:02 +0800 Subject: [PATCH 11/17] fix: invalid title value --- .github/workflows/release.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2d3454a4..e1c13e49 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -176,7 +176,7 @@ jobs: targetBranch: master message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' createPR: true - title: '{{message}}' + title: '' description: | This PR updates the Karpor Helm chart with the following changes: - Bump the `appVersion` to ${{ steps.get_version.outputs.VERSION }} @@ -187,7 +187,6 @@ jobs: **Note**: This PR was automatically generated by the **karpor-chart-updater[bot]**. labels: 'karpor-chart-updater[bot]' token: ${{ secrets.CHART_UPDATER_PAT }} - commitUserName: 'karpor-chart-updater[bot]' workDir: charts - name: Log Test Outputs # Log outputs for debugging From 1cebff36d709852fec3e285b921885a5cc10b9bd Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:33:07 +0800 Subject: [PATCH 12/17] refactor: refine PR description --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e1c13e49..93773d6d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -179,8 +179,8 @@ jobs: title: '' description: | This PR updates the Karpor Helm chart with the following changes: - - Bump the `appVersion` to ${{ steps.get_version.outputs.VERSION }} - - Bump the `version` to ${{ steps.get_chart_version.outputs.new_chart_version }} + - Bump the `appVersion` to `${{ steps.get_version.outputs.VERSION }}` + - Bump the `version` to `${{ steps.get_chart_version.outputs.new_chart_version }}` These updates ensure that the chart reflects the latest Karpor release. From fe93febba3b6dc9ee787be4b7bb24eabc0769421 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:34:07 +0800 Subject: [PATCH 13/17] fix: invalid title --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 93773d6d..172bda18 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -174,9 +174,9 @@ jobs: value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} targetBranch: master - message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' + message: 'bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' createPR: true - title: '' + title: 'chore(karpor): ' description: | This PR updates the Karpor Helm chart with the following changes: - Bump the `appVersion` to `${{ steps.get_version.outputs.VERSION }}` From 1a2786cd273f608a0113ac7e5682ae4f1bb99e2d Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:37:12 +0800 Subject: [PATCH 14/17] fix: invalid title --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 172bda18..467e91fb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -176,7 +176,7 @@ jobs: targetBranch: master message: 'bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' createPR: true - title: 'chore(karpor): ' + title: 'chore(karpor): {{message}}' description: | This PR updates the Karpor Helm chart with the following changes: - Bump the `appVersion` to `${{ steps.get_version.outputs.VERSION }}` From bf476fead9dab732413ebd9a518532ea246cb4c6 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:42:19 +0800 Subject: [PATCH 15/17] fix: invalid title --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 467e91fb..449a61ab 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -174,9 +174,9 @@ jobs: value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} targetBranch: master - message: 'bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' + message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' createPR: true - title: 'chore(karpor): {{message}}' + title: '${{ inputs.message }}' description: | This PR updates the Karpor Helm chart with the following changes: - Bump the `appVersion` to `${{ steps.get_version.outputs.VERSION }}` From 699328bcdc3bfc7da684a28f6eb4d359130ebeda Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:49:04 +0800 Subject: [PATCH 16/17] fix: invalid title assign --- .github/workflows/release.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 449a61ab..c76fba11 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -167,6 +167,8 @@ jobs: - name: Bump version in the related HelmChart Chart.yaml uses: fjogeleit/yaml-update-action@main + env: + COMMIT_MESSAGE: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' with: repository: KusionStack/charts valueFile: 'charts/karpor/Chart.yaml' @@ -174,9 +176,9 @@ jobs: value: ${{ steps.get_version.outputs.VERSION }} branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }} targetBranch: master - message: 'chore(karpor): bump app version to ${{ steps.get_version.outputs.VERSION }}, chart version to ${{ steps.get_chart_version.outputs.new_chart_version }}' + message: ${{ env.COMMIT_MESSAGE }} createPR: true - title: '${{ inputs.message }}' + title: ${{ env.COMMIT_MESSAGE }} description: | This PR updates the Karpor Helm chart with the following changes: - Bump the `appVersion` to `${{ steps.get_version.outputs.VERSION }}` From a5120cb240557a4e9861c58046663538d1390478 Mon Sep 17 00:00:00 2001 From: elliotxx <951376975@qq.com> Date: Fri, 20 Dec 2024 14:51:46 +0800 Subject: [PATCH 17/17] fix: uncomment test code --- .github/workflows/release.yaml | 110 ++++++++++++++++----------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c76fba11..7242af52 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,61 +83,61 @@ jobs: id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # - name: Login to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v2 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - name: Set up Go - # uses: actions/setup-go@v5 - # with: - # go-version: '1.22' - # - name: Set up Node.js - # uses: actions/setup-node@v2 - # with: - # node-version: '20' - - # - name: Install npm packages and build UI - # working-directory: ./ui - # run: | - # npm install - # # Using 'CI=false' prevents build errors due to warnings. - # # It bypasses the 'process.env.CI = true' setting in CI environments - # # that treats warnings as errors, ensuring a successful build. - # CI=false npm run build - # touch build/.gitkeep - - # - name: Determine GoReleaser Config with Regex - # run: | - # tag=${GITHUB_REF#refs/tags/} - # alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - # beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - # rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' - # release='v[0-9]+.[0-9]+.[0-9]+' - # if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then - # echo "Match found for alpha or beta tag" - # echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV - # elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then - # echo "Match found for rc or release tag" - # echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV - # else - # echo "No match found" - # exit 1 - # fi - - # - name: Release the karpor with GoReleaser - # uses: goreleaser/goreleaser-action@v2 - # with: - # distribution: goreleaser - # version: latest - # args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install npm packages and build UI + working-directory: ./ui + run: | + npm install + # Using 'CI=false' prevents build errors due to warnings. + # It bypasses the 'process.env.CI = true' setting in CI environments + # that treats warnings as errors, ensuring a successful build. + CI=false npm run build + touch build/.gitkeep + + - name: Determine GoReleaser Config with Regex + run: | + tag=${GITHUB_REF#refs/tags/} + alpha='v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + beta='v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + rc='v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + release='v[0-9]+.[0-9]+.[0-9]+' + if [[ $tag =~ $alpha ]] || [[ $tag =~ $beta ]]; then + echo "Match found for alpha or beta tag" + echo "GO_RELEASER_CONFIG=.goreleaser-dev.yml" >> $GITHUB_ENV + elif [[ $tag =~ $rc ]] || [[ $tag =~ $release ]]; then + echo "Match found for rc or release tag" + echo "GO_RELEASER_CONFIG=.goreleaser.yml" >> $GITHUB_ENV + else + echo "No match found" + exit 1 + fi + + - name: Release the karpor with GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get new chart version from the chart repo id: get_chart_version