-
Notifications
You must be signed in to change notification settings - Fork 18
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
Github Action to automatically publish PRs to GitHub Pages #52
Conversation
AFAIK, we don't need the metadata. https://github.com/actions/configure-pages/
Because we're not keeping the history of the gh-pages branch, we end up with a new commit every time. Github refuses that we push that branch because it doesn't match the history.
The docs [1] adds a CNAME file if you're publishing from a branch. But since the action wipes the `gh-pages` branch every time, I think the CNAME file will go away. ghp-import has the option to recreate it every time. [1]: https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-a-subdomain
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.
@achabotl I'm a bit confused as to why you need to use ghp-import
and manually do this work instead of just using GitHub Actions to do this (under https://github.com/scipy-conference/conference.scipy.org/settings/pages)
(I tend to do this in a 2 step process of building the website and uplaoding the artifacts and then in a deploy step actually doing the deployment using actions/configure-pages
and actions/deploy-pages
.)
As you're just overwriting the history on the gh-pages
branch
ghp-import -m "Generate Pelican site ${timestamp}" --no-history --branch gh-pages output |
is there a reason to use a branch at all?
* Run on push events to 'main' as the default branch has been renamed from 'master'. * Add running the build job on pull_request events to allow testing builds of the website in advance. * Scope concurrency to the workflow level, which allows for per branch runs to not conflict. * Split the workflow into a build and deploy job. In the build job have the built website be uploaded as a run artifact. In the deploy job this artifact is then downloaded and and deployed to GitHub Pages. - For the deploy job, set the permissions to allow for the default GITHUB_TOKEN to perform the deployment. - Use the github-pages environment as required by GitHub Actions. - Run the deploy job on either: * push events to main (a merged PR) * workflow_dispatch events that happen on any branch, to allow for hotfixing
To be (hopefully) more helpful than just asking questions I opened up PR #53 targetting this PR's branch that impliments the changes I'm suggesting. |
Thanks @matthewfeickert. I used the Also, again, I'm weary of the Beta tag on on using Github Actions. That said, I'll merge PR #53 into this one and go for actions. |
…-deployment ci: Use GitHub Actions to perform deployment
And it works! Well, @matthewfeickert, now you've set a precedent, and I'll copy and paste this workflow file into all my future projects for the next decade. ;) |
I think the "beta" here is relatively benign, as I've been using this across multiple orgs for more than a year with no issues. I've always found it to more mean "there might be API changes in the future" given the docs (https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow) but it is at least a supported service from GitHub.
@achabotl I see that the custom domain isn't set. Is this being handled a different way so that https://scipy-conference.github.io/conference.scipy.org/ properly redirects to https://conference.scipy.org/? Can you also check the "Enforce HTTPS" button? |
I'm working with Jim and Numfocus to setup the DNS first. If I setup the custom domain, https://scipy-conference.github.io/conference.scipy.org/ is inaccessible and I can't see whether or not it works. I'll enable HTTPS once the DNS is set up. |
This is a follow-up to #51 with fixes:
make
target to install dependenciesgh-pages
branch.gh-pages
branch because we're overwriting the content every time.gh-pages
branch every time, the CNAME file goes away. ghp-import has the option to recreate it every time.