From e0c8ac0e413f4fba406ebe4ed4b5954be06fea8d Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 13 Aug 2024 09:37:17 +0200 Subject: [PATCH 1/5] ci: fix update-api-and-cfg-manual workflow --- .github/workflows/update-api-and-cfg-manual.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index ee8eefe48..482ab9ca3 100644 --- a/.github/workflows/update-api-and-cfg-manual.yaml +++ b/.github/workflows/update-api-and-cfg-manual.yaml @@ -42,15 +42,19 @@ jobs: pattern: "emqx-*-schema-dump" repository: ${{ env.REPOSITORY }} run-id: ${{ env.RUN_ID }} + github-token: ${{ secrets.PAT_RO_WORKFLOWS }} merge-multiple: true - name: Create PR to update api docs and config manual + env: + GH_TOKEN: ${{ github.token }} run: | set -euxo pipefail git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" BASE_BRANCH="$(echo release-$(echo $EMQX_VERSION | cut -d '.' -f 1-2))" NEW_BRANCH="update-api-cfg-${EMQX_VERSION}" + git fetch origin git checkout -b ${NEW_BRANCH} --track origin/${BASE_BRANCH} VERSION=$(echo "${EMQX_VERSION}" | cut -d '-' -f 1) From a92d4b1c1912dac07d2065e803d0da3df1111d45 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 13 Aug 2024 09:40:05 +0200 Subject: [PATCH 2/5] ci: fix job name --- .github/workflows/update-api-and-cfg-manual.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index 482ab9ca3..6027c080d 100644 --- a/.github/workflows/update-api-and-cfg-manual.yaml +++ b/.github/workflows/update-api-and-cfg-manual.yaml @@ -24,7 +24,7 @@ permissions: contents: read jobs: - sync-en-doc: + update-api-cfg-manual: runs-on: ubuntu-latest env: EMQX_VERSION: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.version || github.event.inputs.version }} From 95bf10c0a8e1f18c5db77dc2b1afa2ef8426294c Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 13 Aug 2024 09:46:19 +0200 Subject: [PATCH 3/5] ci: download docker images --- .../workflows/update-api-and-cfg-manual.yaml | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index 6027c080d..91722752b 100644 --- a/.github/workflows/update-api-and-cfg-manual.yaml +++ b/.github/workflows/update-api-and-cfg-manual.yaml @@ -45,6 +45,20 @@ jobs: github-token: ${{ secrets.PAT_RO_WORKFLOWS }} merge-multiple: true + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: "emqx-docker" + repository: ${{ env.REPOSITORY }} + run-id: ${{ env.RUN_ID }} + github-token: ${{ secrets.PAT_RO_WORKFLOWS }} + + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: "emqx-enterprise-docker" + repository: ${{ env.REPOSITORY }} + run-id: ${{ env.RUN_ID }} + github-token: ${{ secrets.PAT_RO_WORKFLOWS }} + - name: Create PR to update api docs and config manual env: GH_TOKEN: ${{ github.token }} @@ -64,11 +78,22 @@ jobs: sed -i "s/EE_VERSION=.*/EE_VERSION=${VERSION}/" ./current-version.env sed -i "s/EE_MINOR_VERSION=.*/EE_MINOR_VERSION=${MINOR_VERSION}/" ./current-version.env git add current-version.env + EMQX_TAG=$(docker load < emqx-docker-*.tar.gz | sed 's/Loaded image: //g') + EMQX_ENTERPRISE_TAG=$(docker load < emqx-enterprise-docker-*.tar.gz | sed 's/Loaded image: //g') for edition in ce ee; do - PROFILE=$(echo "${edition}" | sed 's/ce/emqx/g' | sed 's/ee/emqx-enterprise/g') + case "${edition}" in + ce) + PROFILE=emqx + DOCKER_IMAGE=${EMQX_TAG} + ;; + ee) + PROFILE=emqx-enterprise + DOCKER_IMAGE=${EMQX_ENTERPRISE_TAG} + ;; + esac for lang in en zh; do - docker run -d --name emqx -p 18083:18083 -e EMQX_dashboard__i18n_lang=${lang} "emqx/${PROFILE}:${EMQX_VERSION}" + docker run -d --name emqx -p 18083:18083 -e EMQX_dashboard__i18n_lang=${lang} "${DOCKER_IMAGE}" curl -fsS -m 10 --retry 10 --retry-all-errors -o /dev/null http://localhost:18083/api-docs/swagger.json ./rewrite-swagger.sh ${edition} ${lang} docker logs emqx From ce3a6e23b262f22787e6914d5ac300de94eb2485 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 13 Aug 2024 09:49:42 +0200 Subject: [PATCH 4/5] ci: only fetch base branch --- .github/workflows/update-api-and-cfg-manual.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index 91722752b..9298d1558 100644 --- a/.github/workflows/update-api-and-cfg-manual.yaml +++ b/.github/workflows/update-api-and-cfg-manual.yaml @@ -68,7 +68,7 @@ jobs: git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" BASE_BRANCH="$(echo release-$(echo $EMQX_VERSION | cut -d '.' -f 1-2))" NEW_BRANCH="update-api-cfg-${EMQX_VERSION}" - git fetch origin + git fetch origin ${BASE_BRANCH} git checkout -b ${NEW_BRANCH} --track origin/${BASE_BRANCH} VERSION=$(echo "${EMQX_VERSION}" | cut -d '-' -f 1) From f41c1052dee346fc133b0fab5e1cad4c272229e1 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 13 Aug 2024 09:50:21 +0200 Subject: [PATCH 5/5] fix: fix schema dump artifact pattern --- .github/workflows/update-api-and-cfg-manual.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index 9298d1558..6ee508462 100644 --- a/.github/workflows/update-api-and-cfg-manual.yaml +++ b/.github/workflows/update-api-and-cfg-manual.yaml @@ -39,7 +39,7 @@ jobs: - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - pattern: "emqx-*-schema-dump" + pattern: "emqx*-schema-dump" repository: ${{ env.REPOSITORY }} run-id: ${{ env.RUN_ID }} github-token: ${{ secrets.PAT_RO_WORKFLOWS }}