From b5b743bf299bc6683fd6df0852a984c582123e0b Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Sat, 30 Nov 2024 19:16:37 +0000 Subject: [PATCH] setup publish quarto --- .github/workflows/publish.yml | 59 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b15c70a..7b3899d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,54 +1,51 @@ +name: Quarto Publish + on: - workflow_dispatch: push: - branches: main - -name: Quarto Publish + branches: [main, master] + workflow_dispatch: jobs: build-deploy: runs-on: ubuntu-latest - permissions: - contents: write + container: rocker/tidyverse:4.4.2 env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} GIT_CRYPT_KEY64: ${{ secrets.GIT_CRYPT_KEY64 }} steps: - - name: Check out repository - uses: actions/checkout@v4 - + - uses: actions/checkout@v4 + - name: Install system dependencies run: | - sudo apt-get update && apt-get install -y --no-install-recommends \ + apt-get update && apt-get install -y --no-install-recommends \ git-crypt - - - name: Trust git repo + + - name: Trust repo run: | git config --global --add safe.directory /__w/acdc-db-handbook/acdc-db-handbook - - name: Decrypt repository using symmetric key - run: | - echo $GIT_CRYPT_KEY64 > git_crypt_key.key64 && base64 -di git_crypt_key.key64 > git_crypt_key.key && git-crypt unlock git_crypt_key.key - rm git_crypt_key.key git_crypt_key.key64 - - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 - - - name: Install tinytex - run: quarto install tinytex - - - name: Install R - uses: r-lib/actions/setup-r@v2 with: - r-version: '4.4.1' + tinytex: true - - name: Install R Dependencies + - name: Install packages from renv.lock (with cache) + if: ${{ !env.ACT }} uses: r-lib/actions/setup-renv@v2 with: - cache-version: 1 + cache-version: 2 - - name: Render and Publish - uses: quarto-dev/quarto-actions/publish@v2 + - name: Install packages from renv.lock (local, no cache) + if: ${{ env.ACT }} + run: | + renv::restore() + shell: Rscript {0} + + - name: Render document + run: | + quarto render index.qmd + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 with: - target: gh-pages - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + folder: docs \ No newline at end of file