rossjrw / pr-preview-action

GitHub Action that deploys a pull request preview to GitHub Pages, similar to Vercel and Netlify, and cleans up after itself.
https://github.com/marketplace/actions/deploy-pr-preview
MIT License
267 stars 43 forks source link

How to build on `gh-pages` when push on `main` ? #9

Closed kolibril13 closed 2 years ago

kolibril13 commented 2 years ago

https://github.com/rossjrw/pr-preview-action is really convenient to get a quick pull request preview! I'd like to ask: Is it possible to also build the main GitHub pages site on the gh-pages branch, when I push a commit to the main branch? Currently, I use this action https://github.com/JamesIves/github-pages-deploy-action But the problem with this approach: The github-pages-deploy-action overwrites all files on the gh-pages branch, and therefore the files created by pr-preview-action will be overwritten. Here are the two workflows: https://github.com/kolibril13/okapi2/tree/main/.github/workflows

rossjrw commented 2 years ago

Hi @kolibril13, to avoid JamesIves' action overwriting the entire branch, you need to exclude the pr-preview directory, as documented here: https://github.com/rossjrw/pr-preview-action#ensure-your-main-deployment-is-compatible

kolibril13 commented 2 years ago

Thanks a lot!