Skip to content

Publish Catalog 📰 #150

Publish Catalog 📰

Publish Catalog 📰 #150

Workflow file for this run

---
name: Publish Catalog 📰
on:
workflow_call:
secrets:
REPO_GITHUB_TOKEN:
description: |
Github token with write access to the repository
required: false
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "17 17 * * 3,6"
jobs:
publish-latest:
name: Build & Deploy TLGC (latest) 📖
runs-on: ubuntu-latest
container:
image: ghcr.io/insightsengineering/rstudio_4.3.1_bioc_3.17:latest
permissions:
contents: write
steps:
- name: Checkout repo 🛎
uses: actions/checkout@v3
- name: Cache artifacts 📀
uses: actions/cache@v3
with:
path: |
~/package/.staged.dependencies
book/_freeze
key: ${{ runner.os }}-tlg-catalog-latest
- name: Run Staged dependencies 🎦
uses: insightsengineering/staged-dependencies-action@v1
env:
GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
path: "./package"
enable-check: false
direction: upstream
- name: Render catalog 🖨
run: |
cd book
quarto render
shell: bash
- name: Create artifact 📂
if: startsWith(github.ref, 'refs/tags/v')
run: |
pushd book/_site
zip -r9 $OLDPWD/site.zip *
popd
shell: bash
- name: Upload docs ⬆
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: site-development
path: site.zip
- name: Publish docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_site
destination_dir: development
publish-stable:
name: Build & Deploy TLGC (stable) 📖
runs-on: ubuntu-latest
container:
image: ghcr.io/insightsengineering/rstudio_4.3.1_bioc_3.17:latest
permissions:
contents: write
steps:
- name: Checkout repo 🛎
uses: actions/checkout@v3
- name: Cache artifacts 📀
uses: actions/cache@v3
with:
path: |
book/_freeze
key: ${{ runner.os }}-tlg-catalog-stable
- name: Install packages 🎦
run: |
# Installing packages from package/DESCRIPTION.
install.packages(c(
'shinycssloaders', 'binom', 'broom', 'DescTools', 'dplyr', 'forcats',
'ggplot2', 'ggpubr', 'ggrepel', 'grid', 'lubridate', 'renv', 'scales',
'stats', 'stringr', 'tibble', 'tidyr', 'knitr', 'quarto', 'testthat',
'vdiffr', 'withr'
))
# Installing NEST packages from package/DESCRIPTION.
install.packages(c(
'formatters', 'nestcolor', 'rlistings', 'rtables', 'scda', 'scda.2022',
'goshawk', 'osprey', 'teal', 'teal.logger', 'teal.widgets', 'teal.code',
'teal.data', 'teal.transform', 'teal.slice', 'teal.modules.clinical',
'teal.modules.general', 'teal.goshawk', 'teal.osprey', 'tern',
'tern.mmrm', 'tern.rbmi'
), repos='https://insightsengineering.r-universe.dev/')
shell: Rscript {0}
- name: Render catalog 🖨
run: |
cd book
quarto render
shell: bash
- name: Create artifact 📂
if: startsWith(github.ref, 'refs/tags/v')
run: |
pushd book/_site
zip -r9 $OLDPWD/site.zip *
popd
shell: bash
- name: Upload docs ⬆
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: site-stable
path: site.zip
- name: Publish docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_site
destination_dir: stable
upload-release-assets:
name: Upload assets 🔼
needs: [publish-latest, publish-stable]
runs-on: ubuntu-latest
if: >
startsWith(github.ref, 'refs/tags/v')
&& !contains(github.event.commits[0].message, '[skip docs]')
steps:
- name: Checkout repo 🛎
uses: actions/checkout@v3
- name: Download artifact ⏬
uses: actions/download-artifact@v3
with:
name: site-development
path: site-development
- name: Download artifact ⏬
uses: actions/download-artifact@v3
with:
name: site-stable
path: site-stable
- name: Upload binaries to release ⤴
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: site-development/site.zip
asset_name: catalog-development.zip
tag: ${{ github.ref }}
overwrite: true
- name: Upload binaries to release ⤴
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: site-stable/site.zip
asset_name: catalog-stable.zip
tag: ${{ github.ref }}
overwrite: true