Publishing
Publishing somewhere other than gh-pages
The following remains untested. Use with caution.
In some cases, you don’t want your website on the gh-pages
branch. For example, if you are creating releases and you want the website pages archived in that release, then you won’t want your website pages on the gh-pages
branch.
Here are the changes you need to make if you to avoid gh-pages
branch.
At the top of
_quarto.yml
add the following:project: type: website output-dir: docs
On GitHub under “Settings” > “Pages”, set pages to be made from the
docs
branch and thedocs
directory.Make sure
docs
is not listed in.gitignore
Publish the site the first time locally using
quarto publish
from the terminalChange the GitHub Action because you can’t use
quarto publish gh-pages
. You’ll need to push to the ‘docs’ branch yourself (in the GitHub Action)on: push: branches: docs name: Render and Publish jobs: build-deploy: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out repository uses: actions/checkout@v2 with: submodules: recursive - name: Set up R (needed for Rmd) uses: r-lib/actions/setup-r@v2 - name: Install packages (needed for Rmd) run: Rscript -e 'install.packages(c("rmarkdown", "knitr", "jsonlite"))' - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 with: # To install LaTeX to build PDF book # tinytex: true # uncomment below and fill to pin a version # version: 0.9.600 - name: Render Quarto Project uses: quarto-dev/quarto-actions/render@v2 with: to: html - name: Set up Git run: | git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" - name: Commit all changes and push run: | git add -A && git commit -m 'Build site' || echo "No changes to commit" git push origin || echo "No changes to commit"