-
Notifications
You must be signed in to change notification settings - Fork 34
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
Use netlify previews for PRs #340
Comments
Example from PACE hackweek website: https://github.com/PACEHackWeek/pace-2024/blob/main/.github/workflows/netlifypreview.yaml |
Quarto website preview: https://github.com/quarto-dev/quarto-web/blob/main/.github/workflows/preview.yml; It's perhaps a bit bloated, here is the initial inception: quarto-dev/quarto-web#667 |
Netlify will be a bit disconnected from the website, it is just using a site ID and will deploy it to a efermal site; we only want the previews (we want to You use quarto to build the website (takes your markdown and builds the staic website .html). |
Notes from Coworking with @ateucher and @cassienickles, October 10. See Notes Doc for accompanying screenshots. Goal: We want to be able to easily preview additions to the Cookbook from the browser through a (draft) pull request. Background: What is Netlify/why? How does it interact with/different from Quarto?
We will create a “site” in netlify to host our deploy previews. Usually Netlify sites have a source that they pull from (such as GitHub). However, because we don’t want to host our site on Netlify, we don’t want it pulling from the cookbook repo. Instead we will create a site that doesn’t have a defined source set up; rather we will push rendered content to the site using the Netlify API via a GitHub action. “Let’s deploy your project with” Choose GitHub Let’s deploy your project with… keep team as is, Leave everything else as default (including leave Site name blank –it will be auto-generated – since we don’t want the previews to be findable) If the deploy doesn’t publish, click deployment under “Production deploys” and click cancel deployment from the deployment log Build and Deploy > under repository > Manage repository > unlink the repository (in red!) Next copy the github action in this file Next we need to add our Netlify credentials to the cookbook repo in GitHub to allow Netlify to access the PR content to create the preview. Now we add the Netlify auth token secret to GitHub. Go to earthdata-cloud-cookbook repo > Settings > Secrets and variables > Actions. Click “New Repository secret”. Make the Name NETLIFY_AUTH_TOKEN, and paste the token you copied from Netlify in the previous step in the “Secret” box. Click “Add Secret” And that’s it! There is more in Posit’s quarto-web deploy preview action that we could learn from, but for now I think this will suffice. One thing they do is limit the building of previews to PRs from internal branches (not forks). For PRs from forks, the preview is triggered by a repo maintainer adding a special comment in the PR thread (\deploy-preview). |
As per @eeholmes we can use Netlify to create deploy previews on PRs. Importantly, we can use netlify just for the preview and keep using GitHub pages for the main site.
The text was updated successfully, but these errors were encountered: