Skip to content

Commit

Permalink
build: add pkgdown GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
gladkia committed Feb 28, 2024
1 parent 1a03bc4 commit 4c6a2e1
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This workflow is used to update static webpage with documentation for the given GitHub repository.
# It's triggered by the push of the default branch.
# More details: https://docs.google.com/document/d/1WGW4_lOOZ73lEfVZwIWMivbyCgDTJAajxP5N8767DZY

name: pkgdown

on:
push:
branches: [main, master, test_ci_pkgdown]
release:
types: [published]
workflow_call:
inputs:
USERNAME:
required: true
type: string
PACKAGE_NAME:
required: true
type: string
BRANCH_NAME:
required: true
type: string
IS_SUBDIR:
description: "Is the R package stored as the subdirectory of the repository?"
required: false
type: string
default: 'false'
secrets:
PRIVATE_ACCESS_TOKEN:
required: true

permissions:
contents: write

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.PRIVATE_ACCESS_TOKEN }}
TEST_TAG: user/app:latest-${{ github.sha }}
USERNAME: ${{ github.actor }}
PACKAGE_NAME: ${{ github.event.repository.name }}
BRANCH_NAME: ${{ github.head_ref }}
BASE_IMAGE: marcinkam/gdrshiny:1.0
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
uses: docker/build-push-action@v5
with:
context: .
fetch-depth: 0
ref: ${{ env.BRANCH_NAME }}
tags: ${{ env.TEST_TAG }}
build-args: |
GITHUB_TOKEN=${{ secrets.PRIVATE_ACCESS_TOKEN }}
BASE_IMAGE=${{ env.BASE_IMAGE }}
- name: Run pkgdown
if: ${{ inputs.IS_SUBDIR != 'true' }}
run: |
docker run -v `pwd`:/mnt/vol ${{ env.TEST_TAG }} Rscript -e 'pkgdown::build_site_github_pages("/mnt/vol", new_process = FALSE, install = FALSE)'
# currently, internal packages are stored as subdirectories in the repository
# eventually, this loop becomes obsolete (subdirectory structure is not allowed in Bioconductor))
- name: Run pkgdown (R package as subdirectory)
if: ${{ inputs.IS_SUBDIR == 'true' }}
run: |
docker run -v $GITHUB_WORKSPACE:/mnt/vol ${{ env.TEST_TAG }} bash -c "find /mnt/vol/${{ env.PACKAGE_NAME }}"
docker run -v `pwd`:/mnt/vol ${{ env.TEST_TAG }} Rscript -e 'pkgdown::build_site_github_pages("/mnt/vol/${{ env.PACKAGE_NAME }}", new_process = FALSE, install = FALSE)'
- name: Deploy to GitHub pages 🚀
if: ${{ inputs.IS_SUBDIR != 'true' }}
uses: JamesIves/[email protected]
with:
clean: true
branch: pages
folder: docs
target-folder: docs

- name: Deploy to GitHub pages 🚀 (R package as subdirectory)
if: ${{ inputs.IS_SUBDIR == 'true' }}
uses: JamesIves/[email protected]
with:
clean: true
branch: pages
folder: ${{ env.PACKAGE_NAME }}/docs
target-folder: docs

0 comments on commit 4c6a2e1

Please sign in to comment.