Skip to content

Update R/quarto example #161

Update R/quarto example

Update R/quarto example #161

Workflow file for this run

name: Build packages on build branch
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
# =====================================================
# Build
# =====================================================
- name: Build JS and CSS resources
run: |
cd js
npm install
npm run build
npm run build-styles
- name: Build Python package
run: |
cd py
pip install -e .[dev]
make dist
# Even though pip can install from a git repository, we build a Python
# wheel here so that it can be easily installed from Pyodide. In Pyodide,
# pip is not available; it has micropip, which can't install from a git
# repository, but can install a wheel.
# =====================================================
# Commit to main-build branch
# =====================================================
# Name and email are needed to push.
- name: Configure git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Commit built files and push to main-build branch
if: github.ref == 'refs/heads/main'
shell: bash
run: |
export SHA_SHORT=$(git rev-parse --short HEAD)
git checkout -B main-build
git add -f js/out/
git add -f py/dist/*.whl
git commit -m"Build js/css for $SHA_SHORT"
git log -n 4 --pretty=oneline --simplify-by-decoration
git push -f origin main-build:main-build
# =====================================================
# Build and deploy site
# =====================================================
deploy-site:
if: github.ref == 'refs/heads/main'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install R
uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
packages:
any::knitr
any::rmarkdown
any::tibble
any::htmltools
# any::reticulate
- uses: quarto-dev/quarto-actions/setup@v2
- name: Build design doc
run: |
cd js/src/styles
quarto render *.qmd
- name: Build storybook
run: |
cd js/
npm ci
npm run build-storybook
- name: Move build artifacts to site dir
run: |
mkdir -p site
cp -R js/src/styles site/style-guide
cp -R js/storybook-static site/storybook
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./site"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2