| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- name: Update emqx/emqx-docs
- on:
- push:
- tags:
- - 'v*'
- workflow_dispatch:
- inputs:
- tag:
- required: true
- type: string
- permissions:
- contents: read
- jobs:
- update_emqx_docs:
- runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
- env:
- TAG: ${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}
- steps:
- - name: Generate GitHub App token
- id: app-token
- uses: actions/create-github-app-token@v1
- with:
- app-id: ${{ vars.AUTH_APP_ID }}
- private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
- owner: ${{ github.repository_owner }}
- - name: Create PR in emqx/emqx-docs
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh --repo emqx/emqx-docs workflow run update-api-and-cfg-manual.yaml -f version=${GITHUB_REF_NAME##[v|e]} -f repository=${GITHUB_REPOSITORY} -f run_id=${GITHUB_RUN_ID}
- - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- with:
- ref: ${{ env.TAG }}
- fetch-depth: 0
- - name: Detect emqx profile
- id: parse-git-ref
- run: |
- JSON="$(./scripts/parse-git-ref.sh refs/tags/$TAG)"
- PROFILE=$(echo "$JSON" | jq -cr '.profile')
- echo "profile=$PROFILE" | tee -a $GITHUB_ENV
- TAG_PATTERN=$(echo "${TAG:0:1}*")
- PREV_TAG=$(git describe --abbrev=0 --tags --match "${TAG_PATTERN}" --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*' --exclude '*docker*' HEAD~1)
- echo "PREV_TAG=$PREV_TAG" | tee -a $GITHUB_ENV
- - name: Generate changelog
- run: |
- changes_dir=("changes/ce")
- if [ "$PROFILE" == "emqx-enterprise" ]; then
- changes_dir+=("changes/ee")
- fi
- while read -r file; do
- tar --append --file=changes.tar $file
- done < <(git diff --diff-filter=A --name-only "tags/${PREV_TAG}...HEAD" "${changes_dir[@]}")
- gzip changes.tar
- - name: Upload artifact
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
- with:
- name: changes
- path: changes.tar.gz
- retention-days: 7
-
- - name: Trigger update-changelog workflow in emqx/emqx-docs
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
- gh --repo emqx/emqx-docs workflow run update-changelog.yaml -f version=${TAG} -f repository=${GITHUB_REPOSITORY} -f run_id=${GITHUB_RUN_ID}
|