ropensci-review-tools / babelquarto

Renders a Multilingual Quarto Project (Book or Website)
https://docs.ropensci.org/babelquarto/
Other
39 stars 7 forks source link

Add README info on GitHub action to perform babelquarto::render_website() on push #57

Closed blenback closed 1 month ago

blenback commented 2 months ago

Hello,

First let me say thank you for creating babelquarto, we currently use it for a multi-lingual quarto website for our academic research project: NASCENT-Peru.

One small thing that you might consider adding to the package README is that it is possible for users to utilise the render_website() function as part of CI with GitHub Actions i.e. the function is being called following a push to the main branch. This removes the burden for the user to remember to render the website locally before making pushes for deployment.

Here is the code for my GitHub Action to do this with a quarto website:

on:
  workflow_dispatch:
  push:
    branches: main

name: Render multi-lingual website and publish to gh-pages

jobs:
  build-deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Set up Quarto
        uses: quarto-dev/quarto-actions/setup@v2
      - name: Install R
        uses: r-lib/actions/setup-r@v2 
      - name: Set up R dependencies
        uses: r-lib/actions/setup-r-dependencies@v2 
        with:
          packages: |
            any::data.table
            any::fontawesome
            any::pagedown
            any::readxl
            any::bib2df
            any::rmarkdown
            any::leaflet
            any::tidyverse
            any::mapview
            github::quarto-dev/quarto-r
            github::ropensci-review-tools/babelquarto
      - name: Render website with Babelquarto
        run: Rscript -e 'babelquarto::render_website()'
      - name: Publish
        uses: quarto-dev/quarto-actions/publish@v2
        with:
          target: gh-pages
          render: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Thanks again!

maelle commented 2 months ago

Thank you! Would you like to make a PR adding a section about rendering, before the section about content translation?