-
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
ci: Use GitHub Actions to perform deployment #53
ci: Use GitHub Actions to perform deployment #53
Conversation
* 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
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 @tkoyama010 some comments to hopefully make this review more clear.
On my fork I also have this deployed from triggers from a debug example/show-deployment
branch using this workflow with https://matthewfeickert.github.io/conference.scipy.org/
# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source |
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.
c.f. https://github.com/actions/deploy-pages?tab=readme-ov-file#usage for why these.
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} |
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.
c.f. https://github.com/actions/deploy-pages?tab=readme-ov-file#usage again for why these choices but make sure to switch to using GitHub Actions under https://github.com/scipy-conference/conference.scipy.org/settings/pages
(for the conference website you also are going to want to make sure you're using the custom domain as well.)
and then set whatever branch protection rules you'd like for the github-pages
environment under https://github.com/scipy-conference/conference.scipy.org/settings/environments
group: "pages" | ||
cancel-in-progress: false | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: 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.
It is fine to cancel in progress if you scope to the branch level like is done here. If you are firing off another event trigger on the same branch the goal is to overwrite the previous anyway, so no harm in canceling.
@@ -3,22 +3,18 @@ name: Deploy to GitHub Pages | |||
on: | |||
# Runs on pushes targeting the default branch | |||
push: | |||
branches: ["master"] | |||
branches: ["main"] |
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 default branch name is main
Sorry for the delay. Thanks for this. |
Edits PR #52 (though if it is perferable I can just rebase this against
main
and supersede it instead)This also allows us to not use
ghp-import
which is a project that is unmatained.