name: Bump Dashboard Version concurrency: group: bump-dashboard-version-${{ github.event_name }}-${{ github.ref }} cancel-in-progress: true on: workflow_dispatch: inputs: emqx-name: required: true type: choice default: emqx options: - emqx - emqx-enterprise version: description: 'Dashboard version' type: string required: true permissions: contents: read jobs: bump-dashboard-version: runs-on: ubuntu-latest env: EMQX_NAME: ${{ github.event.inputs.emqx-name }} DASHBOARD_VERSION: ${{ github.event.inputs.version }} permissions: contents: write pull-requests: write steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Create PR to update dashboard version in Makefile 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" git fetch origin BASE_BRANCH="$(git branch --remotes --list 'origin/release-5?' | sort -r | head -n 1 | cut -d '/' -f 2)" NEW_BRANCH="bump-${EMQX_NAME}-dashboard-version-$(date +"%Y%m%d-%H%M%S")" git checkout -b ${NEW_BRANCH} --track origin/${BASE_BRANCH} case "${EMQX_NAME}" in emqx) sed -i "s|EMQX_DASHBOARD_VERSION ?= .*|EMQX_DASHBOARD_VERSION ?= ${DASHBOARD_VERSION}|" Makefile ;; emqx-enterprise) sed -i "s|EMQX_EE_DASHBOARD_VERSION ?= .*|EMQX_EE_DASHBOARD_VERSION ?= ${DASHBOARD_VERSION}|" Makefile ;; esac git add Makefile git commit -m "chore: bump dashboard version" git push origin ${NEW_BRANCH}:${NEW_BRANCH} for pr in $(gh pr list --state open --base ${BASE_BRANCH} --label bump-dashboard-version --search "bump ${EMQX_NAME} dashboard version in:title" --repo ${{ github.repository }} --json number --jq '.[] | .number'); do gh pr close $pr --repo ${{ github.repository }} --delete-branch || true done gh pr create --title "bump ${EMQX_NAME} dashboard version" --body '' --base ${BASE_BRANCH} --head ${NEW_BRANCH} --label bump-dashboard-version --repo ${{ github.repository }}