Skip to content

Create update-antora-ui-spring action #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2024

Conversation

marcusdacoregio
Copy link
Contributor

No description provided.

Copy link
Collaborator

@rwinch rwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @marcusdacoregio I've left feedback inline

- name: Get Current UI Bundle URL
id: current
if: ${{ steps.check-existing-pr.outputs.continue == 'true' }}
run: echo current_ui_bundle_url=$(awk '/^ui:/{f=1; next} f && /^ bundle:/{f=2; next} f==2 && /^ url:/{print $2; exit}' antora-playbook.yml) >> $GITHUB_OUTPUT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will need to parameterize the file to search (with a default of antora-playbook.yml) because the playbook can be specified in more than way (arguments, yml, toml, etc)

For example, Spring Boot specify the playbook file from an entry in package.json.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think that the URL should be found using a regex that matches https://github.com/spring-io/antora-ui-spring/releases/download/(latest|v\d+\.\d+\.\d+)/ui-bundle.zip since parsing a yml file doesn't work for cases like Spring Boot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it is now using the following command to find the link:

grep -oE 'http[s]?://[^ ]+/ui-bundle.zip' -i -w ${{ inputs.antora-file-path }}

run: |
pr_count=$(gh pr list --head ${{ inputs.workflow-branch }} --base ${{ inputs.docs-branch }} --state open --json id | jq length)
if [[ $pr_count -eq 0 ]]; then
echo "continue=true" >> $GITHUB_OUTPUT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want it to stop if there is an existing PR? What happens if a PR is created for version 0.0.1 and then a newer version of the UI becomes available? Should we perhaps update the existing PR in that case?

At minimum, I think we should document (in the README) what happens when a PR already exists. We should also document how to get it to create a PR for the latest version (e.g. close the PR and delete the branch). It would be valuable to echo out that it is not continuing looking for a newer version and why with a link to the section of the README too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added to the README what happens when there is an open PR

description: A GitHub Action that detects if there is a new version of the Antora UI Spring artifact and creates a PR to update the antora-playbook.yml file to use the new version.

inputs:
docs-branch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is helpful to update the docs-build branch, but we should consider that we should also be able to send PRs for the currently active branches (e.g. main, 6.2.x, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added to the README how to make it run for multiple branches:

jobs:
  update-antora-ui-spring:
    runs-on: ubuntu-latest
    name: Update Antora UI Spring
    strategy:
      matrix:
        branch: ['main', 'docs-build']
    steps:
      - uses: spring-io/spring-docs-actions/update-antora-spring-ui@{ACTION_VERSION}
        name: Update antora-playbook.yml
        with:
          docs-branch: ${{ matrix.branch }}
          token: ${{ secrets.GITHUB_TOKEN }}

docs-branch:
description: The branch where the antora-playbook.yml file is. Default is docs-build
default: 'docs-build'
workflow-branch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there can be more than one PR branch (see comment on docs-branch), this probably needs to be based off of the docs-branch with a prefix or suffix. For example main_update-antora-ui-spring, 4.0.x_update-antora-ui-spring. Note that we have various rules in place if a branch ends with .x so starting with the branch name ensures we don't get problems with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch name is now ${{ inputs.docs-branch }}_${{ inputs.workflow-branch-suffix }}

@marcusdacoregio marcusdacoregio force-pushed the upgrade-antora-ui-spring branch from e37e786 to a722fe2 Compare May 17, 2024 17:40
@marcusdacoregio marcusdacoregio requested a review from rwinch May 17, 2024 17:45
Copy link
Collaborator

@rwinch rwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It looks good to me.

@rwinch rwinch merged commit 9ab6029 into spring-io:main May 17, 2024
1 check passed
@rwinch rwinch added this to the 0.0.18 milestone May 17, 2024
@rwinch rwinch self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants