-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create update-antora-ui-spring action #24
Conversation
There was a problem hiding this 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
update-antora-spring-ui/action.yml
Outdated
- 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 }}
update-antora-spring-ui/action.yml
Outdated
docs-branch: | ||
description: The branch where the antora-playbook.yml file is. Default is docs-build | ||
default: 'docs-build' | ||
workflow-branch: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }}
e37e786
to
a722fe2
Compare
There was a problem hiding this 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.
No description provided.