Skip to content
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

Update doc website on every push to main #53

Merged
merged 20 commits into from
Jan 6, 2023

Conversation

chiphogg
Copy link
Contributor

@chiphogg chiphogg commented Dec 24, 2022

This workflow will keep the documentation website up to date with main,
automatically.

We also used an action which sets the git user to the github-actions
bot, which makes the branch history for gh-pages look nicer.

Currently, in order for the manifest in au.hh and au_noio.hh to be
correct, we must fetch the entire repo (all branches and tags) at the
checkout step. This will get more expensive over time as the repo
grows. However, we don't expect huge amounts of growth, and this step
is not very time-sensitive, and we're currently at only 1 second, so
this should be good enough for the foreseeable future.

To test it, we set it up initially to trigger on pull requests, too.
This let us hammer out the kinks. Check out the recent history of the
gh-pages branch (especially activity on Dec 24, 2022) to see the
results: https://github.com/aurora-opensource/au/commits/gh-pages

After this PR was first posted, we also reduced the permissions of the
GITHUB_TOKEN globally, to be read-only by default (so we could follow
the principle of least privilege). This specific workflow needs write
access to the contents of the repository, because we are pushing commits
to the gh-pages branch. Thus, we now include this permission
explicitly.

This workflow will keep the documentation website up to date with main,
automatically.

To test it, we'll set it up to trigger on pull requests, too.  This will
show us whether deployment works from a github workflow.  Before
landing, we'll remove the pull request trigger.
I cancelled the `--force` attempt, because it might kill all the history
for the branch.  (Not that we care much about the `gh-pages` branch, but
I'm hesitant to take an irreversible step before trying other
approaches.)
Their absence prevents us from getting correct descriptions.
Maybe that's why the description wasn't working?
@chiphogg
Copy link
Contributor Author

The main blocker right now is that the git description isn't showing up correctly in au.hh. When I run the deploy command locally, it includes the tags, but not when I run via github actions.

@chiphogg
Copy link
Contributor Author

This looks promising: actions/checkout#701

The `git describe` is working again, but it's referring to weird merge
commits such as 7f283f0.  I can't
figure out what is creating these commits.

One of the parents happens to be the current HEAD of main.  This makes
it seem likely that it would "just work" if we restrict it to main
(which we want to do anyway), because the attempt to merge that branch
with itself should be a no-op.  I'm going to try triggering on this
present branch first though.
Also, tweak the comment.
@chiphogg chiphogg marked this pull request as ready for review December 24, 2022 21:47
We expect this to fail based on reduced permissions for the
GITHUB_TOKEN.
This may not be enough; we may need to add id-token permissions too.
I did get a failure, but not the one I expected.
This time I did get the failure I expected.
After all, I'm just pushing to a branch.
This cleans up the temporary triggering from this PR.
Copy link
Member

@timhirsh timhirsh left a comment

Choose a reason for hiding this comment

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

LGTM

Does the build still pass if it's a noop (i.e no doc changes contained in a PR that lands on mainline)? If so we're probably ok, but something to consider would be to only run the action if docs/** files have changed (or other relevant docs deps) using explicit paths.

@chiphogg
Copy link
Contributor Author

chiphogg commented Jan 6, 2023

LGTM

Does the build still pass if it's a noop (i.e no doc changes contained in a PR that lands on mainline)? If so we're probably ok, but something to consider would be to only run the action if docs/** files have changed (or other relevant docs deps) using explicit paths.

Hmm... I really like that idea in principle, but I wonder how it interacts with the auto-generated single-file packages, au.hh and au_noio.hh. Those depend on basically all of au/. Might be hard to craft the right pattern... and in fact, technically, they depend on literally any change because of the version stamping in the manifest.

Still, maybe someday we could consider only generating them on tags, say.

@chiphogg chiphogg merged commit a7f884a into main Jan 6, 2023
@chiphogg chiphogg deleted the chiphogg/autodeploy-doc-site branch January 6, 2023 21:27
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.

None yet

2 participants