Skip to content

Merge pull request #20 from maouw/content/psych-partition-init #16

Merge pull request #20 from maouw/content/psych-partition-init

Merge pull request #20 from maouw/content/psych-partition-init #16

on:
push:
branches: main
name: Render with Quarto and Publish
# you need these permissions to publish to GitHub pages
permissions:
contents: write
pages: write
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: "Set URLs in _quarto.yml"
uses: mikefarah/yq@master
with:
cmd: |
export GITHUB_REPOSITORY_NAME="${GITHUB_REPOSITORY_NAME:-${GITHUB_REPOSITORY##*/}}"
export GITHUB_PAGES_URL="https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY_NAME}"
export GITHUB_REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
export GITHUB_ISSUE_URL="${GITHUB_REPO_URL}/issues/new"
# Replace the URLs in _quarto.yml:
yq -i '
.website.site-url = strenv(GITHUB_PAGES_URL) |
.website.repo-url = strenv(GITHUB_REPO_URL) |
.website.issue-url = strenv(GITHUB_ISSUE_URL)
' _quarto.yml
cat _quarto.yml >&2 # show the file after the changes
# Replace the URLs in docs/_metadata.yml:
yq -i '
.site-url = strenv(GITHUB_PAGES_URL) |
.repo-url = strenv(GITHUB_REPO_URL) |
.issue-url = strenv(GITHUB_ISSUE_URL)
' docs/_metadata.yml
cat docs/_metadata.yml >&2 # show the file after the changes
- name: "Update URLs in glossary.yml"
run: |
sed -i -E 's/\(\/docs\//(\/compute_docs\/docs\//g' glossary.yml
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: pre-release
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Set R version
run: |
R_VERSION="$(Rscript -e 'cat(as.character(getRversion()))')"
echo "R_VERSION=${R_VERSION}" >> $GITHUB_ENV
- name: Restore R package cache
if: inputs.cache == 'true'
uses: actions/cache@v3
with:
path: |
${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ env.R_VERSION }}
- name: Install R dependencies
run: |
Rscript -e 'install.packages("rmarkdown")'
- name: Publish to GitHub Pages (and render)
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}