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

Upload the branch version of the website for pull requests #11

Merged
merged 4 commits into from
May 19, 2024

Conversation

JeremyMcCormick
Copy link
Collaborator

@JeremyMcCormick JeremyMcCormick commented May 17, 2024

This updates the Github actions so that pull requests will deploy the branch's version of the website to v/${BRANCH_NAME} under the main site. The base URL is specified using the -b command line argument to hugo so that links correctly point to the branch version site instead of the main one.

The Github action files were renamed to be clearer and more concise. The build_main action will update the main site on merges to main. The build_version action deploys a pull request's branch changes as described above. The steps for the main workflow were simplified, as the versioned sites are deployed using a totally separate action now, and the dry-run configuration was no longer required.

Additionally, I have added a Github action to setup the hugo tool by downloading and adding it to a cache, so that it can be reused in different workflows without requiring setup from scratch every time.

Changes were tested on this branch where I verified that the links look correct and point to the versioned site instead of the main site.

The new, simplified workflow for deploying the main site won't trigger until the PR is merged.

@JeremyMcCormick JeremyMcCormick force-pushed the iss10 branch 4 times, most recently from 001f20f to 1b6e30a Compare May 17, 2024 22:25
Also change the main upload action to only execute when the action is
not triggered by a PR.
Copy link
Member

@gmantele gmantele left a comment

Choose a reason for hiding this comment

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

It all looks fine to me and it seems to work very well.

Just a question for long term maintenance: what happens when the branch/PR disappear? The corresponding version still stays on the server. Maybe it should be removed when the branch disappear, isn't it?

@JeremyMcCormick
Copy link
Collaborator Author

JeremyMcCormick commented May 19, 2024

Just a question for long term maintenance: what happens when the branch/PR disappear? The corresponding version still stays on the server. Maybe it should be removed when the branch disappear, isn't it?

The versions would just stay there. We leave them on Rubin, as you can see here, for example.

If we decide that they should be deleted after the corresponding PR is merged to main, that is something I could look at doing in another PR. I don't have a strong preference either way.

@JeremyMcCormick JeremyMcCormick merged commit 64a705a into main May 19, 2024
1 check passed
@gmantele
Copy link
Member

Ok. I did not want to say we should, but more that it is something we may have to just think now (and later, we can perform the decided action, if needed). But sure, it is perfectly OK with me to do that, if necessary, in another PR ; that's exactly what I had in mind when approving this PR 😉

@JeremyMcCormick JeremyMcCormick deleted the iss10 branch May 19, 2024 06:01
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