-
Notifications
You must be signed in to change notification settings - Fork 150
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
fix(docs): docs published with incorrect version number + api docs missing after release #1066
fix(docs): docs published with incorrect version number + api docs missing after release #1066
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.
@dreamorosi Thanks for the detailed description about the issues!
Let me double check my understanding.
Reusable Publish docs
workflow can be triggered from 3 scenarios:
- (GitHub) Release (
publish-docs-on-releases.yml
) - Manual trigger (from
publish-docs-on-releases.yml
) - Merge to main (line 26 in
on-merge-to-main.yml
)
Is that correct?
If that is the case, can the issue 2 (checking out the wrong version) also happens in merge to main scenario?
@@ -18,6 +18,8 @@ jobs: | |||
secrets: | |||
token: ${{ secrets.GITHUB_TOKEN }} | |||
run-unit-tests: | |||
needs: get_pr_details | |||
if: ${{ needs.get_pr_details.outputs.prIsMerged == 'true' }} |
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.
Q: why do we need prIsMerged
to be true? I thought this workflow is triggerred only when PR merged.
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.
This workflow is actually triggered by record_pr.yml
, which in turn is triggered every time a PR is opened, updated (title or description change), or closed. This is a design that we copied from the Powertools Python repo.
The reason why we don't want to trigger directly is that this workflow is somewhat privileged and we don't want to allow forks to access it. So we trigger the workflow that exports the PR details for most events, and then dispatch the other downstream workflows. Then those workflows can decide what to do based on the content/status of the PR.
Yes, your understanding is correct.
No, because when we merge on |
Description of your changes
As described in #1063 there were two issues related to the docs publishing after a release. Both issues were due to oversights on my part.
Issue 1 - API docs are missing
The first one was that I removed a step from the
reusable-publish-docs
(link) and this step was the one that published the API docs under the correct version number in the docs. You can verify this by checking the/latest
version of the docs, which works (while thev1.1.0
doesn't). Adding back the step fixes the docs missing issue.Issue 2 - Incorrect version number
The second one was instead due to a behavior of GitHub Actions that I misunderstood.
For context: we have 2 workflows:
make-release
(link) andreusable-publish-docs
(link).The first one is triggered manually, the second is called by the former as the last step (we also use it elsewhere, hence it’s
reusable-
prefix).During the
make-release
workflow we perform some actions, one of these is to increment the version of our packages, commit, & push a tag.When
make-release
callsreusable-publish-docs
I was expecting the latter to checkout the code that contains the latest changes & tag, so that it can build the docs using the correct version number.What happens instead is that when checking out the actions/checkout action detects the latest tag (L517 of “Checkout code step” here) but then the code in the repo & the tag used are the previous & same as the one in the make-release context.
Below a diagram that visually represents what described so far:

Reading the docs on reusing workflow though, there are some info that I was missing. Below two key excerpts:
and
This means that even though the called workflow (
reusable-publish-docs
) was correctly detecting the presence of a new tag, the context used and the the version of the repo checked out, were the same as themake-release
one, which was in a point in time before the release & consequent version bump.There are two solutions that come to mind here:
Finally, I'm also adding a way to manually trigger the publish docs workflow as a break-glass solution that will allow us to manually trigger a docs publish if any of the other triggers fails.
How to verify this change
Review the code & see these workflow runs in a fork:
make-release
- result here - (only difference here is that I'm not publishing to NPM, otherwise the workflow is the same)reusable-publish-docs
workflow - result hereAdditionally, I have also run the publish docs workflow manually, here's the result.
Related issues, RFCs
Issue number: #1063
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.