diff --git a/.github/workflows/update-api-and-cfg-manual.yaml b/.github/workflows/update-api-and-cfg-manual.yaml index ee8eefe48..6ee508462 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 }} @@ -39,18 +39,36 @@ 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 }} 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 }} 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 ${BASE_BRANCH} git checkout -b ${NEW_BRANCH} --track origin/${BASE_BRANCH} VERSION=$(echo "${EMQX_VERSION}" | cut -d '-' -f 1) @@ -60,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