From ceda8e8370ef9666975c2c689d309932cf0ab61d Mon Sep 17 00:00:00 2001 From: Marcus Hert Da Coregio Date: Fri, 3 May 2024 10:41:48 -0300 Subject: [PATCH] Add update-antora-ui-spring.yml workflow --- .github/workflows/update-antora-ui-spring.yml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/update-antora-ui-spring.yml diff --git a/.github/workflows/update-antora-ui-spring.yml b/.github/workflows/update-antora-ui-spring.yml new file mode 100644 index 0000000..3389f99 --- /dev/null +++ b/.github/workflows/update-antora-ui-spring.yml @@ -0,0 +1,47 @@ +name: Update Antora UI Spring + +on: + workflow_call: + inputs: + docs-branch: + description: Branch used by Antora, defaults to docs-build + required: false + default: 'docs-build' + type: string + secrets: + token: + description: GitHub Token to Use to Open the PR + required: false + +jobs: + update-antora-ui-spring: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.docs-branch }} + - name: Get Current UI Bundle URL + uses: mikefarah/yq@v4.43.1 + id: current + with: + cmd: yq '.ui.bundle.url' antora-playbook.yml + - name: Get Latest UI Bundle URL + id: latest + run: | + echo latest_ui_bundle_url=$(gh api /repos/spring-io/antora-ui-spring/releases/latest | jq -r '.assets[] | select(.name == "ui-bundle.zip") | .browser_download_url') >> $GITHUB_OUTPUT + echo tag_name=$(gh api /repos/spring-io/antora-ui-spring/releases/latest | jq -r '.tag_name') >> $GITHUB_OUTPUT + shell: bash + - name: Replace Version + uses: mikefarah/yq@v4.43.1 + id: replace + if: ${{ steps.current.outputs.result != steps.latest.outputs.latest_ui_bundle_url }} + with: + cmd: yq -i '.ui.bundle.url = "${{ steps.latest.outputs.latest_ui_bundle_url }}"' antora-playbook.yml + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ inputs.token }} + title: Update Antora UI Spring to ${{ steps.latest.outputs.tag_name }} + commit-message: Update Antora UI Spring to ${{ steps.latest.outputs.tag_name }} + delete-branch: true + base: ${{ inputs.docs-branch }}