From 32ddcef8f330ad816d1e1e3873fe511246be45e6 Mon Sep 17 00:00:00 2001 From: huangzhangshu Date: Tue, 27 Feb 2024 19:03:40 +0800 Subject: [PATCH 1/3] chore: release ent addons chart --- .github/workflows/release-helm-chart.yml | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/release-helm-chart.yml b/.github/workflows/release-helm-chart.yml index 661f11e0e70..e49910cdd8a 100644 --- a/.github/workflows/release-helm-chart.yml +++ b/.github/workflows/release-helm-chart.yml @@ -14,6 +14,7 @@ on: env: GH_TOKEN: ${{ github.token }} RELEASE_VERSION: ${{ github.ref_name }} + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} jobs: release-version: @@ -158,5 +159,55 @@ jobs: APECD_REF: "v0.1.52" secrets: inherit + release-addons-chart-ent: + needs: [ release-addons-chart ] + uses: apecloud/apecloud-cd/.github/workflows/release-charts-enterprise.yml@v0.1.53 + with: + GITHUB_REPO: "apecloud/apecloud-addons" + GITHUB_REF: ${{ github.ref }} + CHART_DIR: "addons" + APECD_REF: "v0.1.53" + ENABLE_JIHU: false + secrets: inherit + get-addons-chart-dir-ent: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.get_addons_chart_dir.outputs.matrix }} + steps: + - name: Checkout apecloud-addons Code + uses: actions/checkout@v4 + with: + repository: apecloud/apecloud-addons + path: apecloud-addons + ref: ${{ github.ref }} + token: ${{ env.GITHUB_TOKEN }} + - name: get addons chart dir + id: get_addons_chart_dir + run: | + addons_list=$(ls apecloud-addons/addons) + ADDONS_DIR="" + for addons_name in $( echo "$addons_list" ); do + if [[ -z "$ADDONS_DIR" ]]; then + ADDONS_DIR="{\"addon-name\":\"$addons_name\"}" + else + ADDONS_DIR="$ADDONS_DIR,{\"addon-name\":\"$addons_name\"}" + fi + done + echo "$ADDONS_DIR" + echo "matrix={\"include\":[$ADDONS_DIR]}" >> $GITHUB_OUTPUT + + release-addons-chart-jihu-ent: + needs: [ get-addons-chart-dir-ent ] + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.get-addons-chart-dir-ent.outputs.matrix) }} + uses: apecloud/apecloud-cd/.github/workflows/release-charts-jihu-enterprise.yml@v0.1.53 + with: + GITHUB_REPO: "apecloud/apecloud-addons" + GITHUB_REF: ${{ github.ref }} + CHART_DIR: "addons" + SPECIFY_CHART: "${{ matrix.addon-name }}" + APECD_REF: "v0.1.53" + secrets: inherit From 31b9622672810653b11b0926a17a83e94ee751e8 Mon Sep 17 00:00:00 2001 From: huangzhangshu Date: Tue, 27 Feb 2024 19:33:40 +0800 Subject: [PATCH 2/3] chore: check apis doc and auto update apis doc when release --- .github/workflows/cicd-push.yml | 14 ++--------- .github/workflows/release-version.yml | 36 ++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cicd-push.yml b/.github/workflows/cicd-push.yml index 350c729cd18..fcd1ba0a650 100644 --- a/.github/workflows/cicd-push.yml +++ b/.github/workflows/cicd-push.yml @@ -256,21 +256,11 @@ jobs: go-version: "${{ env.GO_VERSION }}" - name: Check apis doc - id: check-apis-doc run: | make doc FILE_CHANGES=`git diff --name-only ${{ github.sha }}` if [[ ! -z "$FILE_CHANGES" ]]; then echo $FILE_CHANGES - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git commit -a -m "chore: auto update apis doc changes" + echo "make doc causes apis doc changes" + exit 1 fi - echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT - - - name: Push apis doc changes - uses: ad-m/github-push-action@master - if: ${{ steps.check-apis-doc.outputs.file_changes }} - with: - github_token: ${{ env.GITHUB_TOKEN }} - branch: ${{ github.ref }} diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 1b861b84da1..eca27eaa412 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -104,6 +104,34 @@ jobs: - name: checkout branch ${{ github.ref_name }} uses: actions/checkout@v4 + - name: install lib + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libbtrfs-dev \ + libdevmapper-dev + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + + - name: Update apis doc + id: update_apis_doc + run: | + make doc + FILE_CHANGES=`git diff --name-only ${{ github.sha }}` + if [[ ! -z "$FILE_CHANGES" ]]; then + echo $FILE_CHANGES + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git commit -a -m "chore: auto update apis doc changes" + fi + echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT + + RELEASE_COMMIT="$(git rev-parse HEAD)" + echo 'RELEASE_COMMIT='${RELEASE_COMMIT} >> $GITHUB_ENV + - name: Checkout kubeblocks-addons ${{ github.ref_name }} uses: actions/checkout@v4 with: @@ -127,7 +155,7 @@ jobs: fi fi done - FILE_CHANGES=`git diff --name-only ${{ github.sha }}` + FILE_CHANGES=`git diff --name-only ${{ env.RELEASE_COMMIT }}` if [[ ! -z "$FILE_CHANGES" ]]; then echo $FILE_CHANGES git config --local user.name "$GITHUB_ACTOR" @@ -140,20 +168,20 @@ jobs: echo 'RELEASE_COMMIT='${RELEASE_COMMIT} >> $GITHUB_ENV - name: push addons version changes to new branch - if: ${{ steps.upgrade_addon_version.outputs.file_changes && github.ref_name == 'main' }} + if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && github.ref_name == 'main' }} uses: ad-m/github-push-action@master with: github_token: ${{ env.GITHUB_TOKEN }} branch: support/auto-upgrade-addons-${{ env.RELEASE_COMMIT }} - name: auto create pr head new branch - if: ${{ steps.upgrade_addon_version.outputs.file_changes && github.ref_name == 'main' }} + if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && github.ref_name == 'main' }} run: | gh pr create --head "support/auto-upgrade-addons-${{ env.RELEASE_COMMIT }}" --title "chore: auto upgrade kubeblocks addons version" --body "" - name: push addons version changes uses: ad-m/github-push-action@master - if: ${{ steps.upgrade_addon_version.outputs.file_changes && github.ref_name != 'main' }} + if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && github.ref_name != 'main' }} with: github_token: ${{ env.GITHUB_TOKEN }} branch: ${{ github.ref }} From 3e43256272ff48b8bf9f072bbfca47a322e022d3 Mon Sep 17 00:00:00 2001 From: huangzhangshu Date: Tue, 27 Feb 2024 19:38:58 +0800 Subject: [PATCH 3/3] chore: change pr title --- .github/workflows/release-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index eca27eaa412..2878a2cabe7 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -172,12 +172,12 @@ jobs: uses: ad-m/github-push-action@master with: github_token: ${{ env.GITHUB_TOKEN }} - branch: support/auto-upgrade-addons-${{ env.RELEASE_COMMIT }} + branch: support/auto-update-${{ env.RELEASE_COMMIT }} - name: auto create pr head new branch if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && github.ref_name == 'main' }} run: | - gh pr create --head "support/auto-upgrade-addons-${{ env.RELEASE_COMMIT }}" --title "chore: auto upgrade kubeblocks addons version" --body "" + gh pr create --head "support/auto-update-${{ env.RELEASE_COMMIT }}" --title "chore: auto upgrade addons version or update apis doc" --body "" - name: push addons version changes uses: ad-m/github-push-action@master