Skip to content

Commit

Permalink
Stable release channel for TLG catalog (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Oct 5, 2023
1 parent f0bf380 commit a5e0d83
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 24 deletions.
132 changes: 116 additions & 16 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ name: Publish Catalog 📰

on:
workflow_call:
secrets:
REPO_GITHUB_TOKEN:
description: |
Github token with write access to the repository
required: false
GCHAT_WEBHOOK:
description: |
Google Chat webhook to send failure notifications
required: false
workflow_dispatch:
push:
tags:
- "v*"
branches:
- main
schedule:
- cron: "17 17 * * 3,6"

jobs:
publish:
name: Build & Deploy TLGC 📖
publish-dev:
name: Build & Deploy TLGC (dev) 📖
runs-on: ubuntu-latest
container:
image: ghcr.io/insightsengineering/rstudio_4.3.1_bioc_3.17:latest
Expand All @@ -30,7 +37,12 @@ jobs:
path: |
~/package/.staged.dependencies
book/_freeze
key: ${{ runner.os }}-tlg-catalog
key: ${{ runner.os }}-tlg-catalog-dev

- name: Normalize variables 📏
run: |
echo "gchat_webhook=${{ secrets.GCHAT_WEBHOOK }}" >> $GITHUB_ENV
shell: bash

- name: Run Staged dependencies 🎦
uses: insightsengineering/staged-dependencies-action@v1
Expand All @@ -43,34 +55,106 @@ jobs:

- name: Render catalog 🖨
run: |
cd book
quarto render
quarto render --profile development
shell: bash
working-directory: book

- name: Create artifact 📂
if: startsWith(github.ref, 'refs/tags/v')
run: |
zip -r9 ../../site.zip *
shell: bash
working-directory: book/_site

- 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

- name: GChat notification 🔔
if: (failure() || cancelled()) && env.gchat_webhook != ''
uses: insightsengineering/google-chat-notification@master
with:
name: ${{ github.event.repository.name }} - development
url: ${{ secrets.GCHAT_WEBHOOK }}
status: ${{ job.status }}

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: Normalize variables 📏
run: |
echo "gchat_webhook=${{ secrets.GCHAT_WEBHOOK }}" >> $GITHUB_ENV
shell: bash

- name: Install packages 🎦
run: |
devtools::install_dev_deps(".", repos = c("https://insightsengineering.r-universe.dev/", "https://cloud.r-project.org/"))
shell: Rscript {0}
working-directory: package

- name: Render catalog 🖨
run: |
quarto render --profile stable
shell: bash
working-directory: book

- name: Create artifact 📂
if: startsWith(github.ref, 'refs/tags/v')
run: |
pushd book/_site
zip -r9 $OLDPWD/site.zip *
popd
zip -r9 ../../site.zip *
shell: bash
working-directory: book/_site

- name: Upload docs ⬆
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: site.zip
name: site-stable
path: site.zip

- name: Publish docs
- name: Publish docs 📔
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_site
destination_dir: stable

- name: GChat notification 🔔
if: (failure() || cancelled()) && env.gchat_webhook != ''
uses: insightsengineering/google-chat-notification@master
with:
name: ${{ github.event.repository.name }} - stable
url: ${{ secrets.GCHAT_WEBHOOK }}
status: ${{ job.status }}

upload-release-assets:
name: Upload assets 🔼
needs: publish
needs: [publish-dev, publish-stable]
runs-on: ubuntu-latest
if: >
startsWith(github.ref, 'refs/tags/v')
Expand All @@ -82,13 +166,29 @@ jobs:
- name: Download artifact ⏬
uses: actions/download-artifact@v3
with:
name: site.zip
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.zip
asset_name: catalog.zip
file: site-stable/site.zip
asset_name: catalog-stable.zip
tag: ${{ github.ref }}
overwrite: true
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ jobs:
docs:
name: Docs 📚
needs: release
uses: ./.github/workflows/docs.yaml
uses: ./.github/workflows/docs.yml
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }}
release:
name: Create release 🎉
uses: insightsengineering/r.pkg.template/.github/workflows/release.yaml@main
with:
package-subdirectory: package
permissions:
contents: write
14 changes: 14 additions & 0 deletions book/_quarto-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
website:
title: TLG Catalog - Dev
navbar:
right:
- text: "Dev"
menu:
- text: "Stable"
href: "https://insightsengineering.github.io/tlg-catalog/stable"
- icon: slack
href: https://app.slack.com/client/T028PB489D3/
aria-label: Slack
- icon: github
href: https://github.com/insightsengineering/tlg-catalog
aria-label: Repository
14 changes: 14 additions & 0 deletions book/_quarto-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
website:
title: TLG Catalog - Stable
navbar:
right:
- text: "Stable"
menu:
- text: "Dev"
href: "https://insightsengineering.github.io/tlg-catalog/development"
- icon: slack
href: https://app.slack.com/client/T028PB489D3/
aria-label: Slack
- icon: github
href: https://github.com/insightsengineering/tlg-catalog
aria-label: Repository
7 changes: 0 additions & 7 deletions book/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ website:
collapse: false
background: primary
search: true
right:
- icon: slack
href: https://app.slack.com/client/T028PB489D3/
aria-label: Slack
- icon: github
href: https://github.com/insightsengineering/tlg-catalog
aria-label: Repository
sidebar:
- id: sidebar
style: docked
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit a5e0d83

Please sign in to comment.