Skip to content

Commit

Permalink
4
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Nov 14, 2023
1 parent 139902f commit e29cf95
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 111 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/AEF-DDF-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
strategy:
matrix:
workflow: [lint, document]
uses: ./.github/workflows/AEF-DDF-dispatch.yaml
uses: ./.github/workflows/dispatch.yaml
with:
workflow: ./.github/workflows/${{ matrix.workflow }}.yaml@workflows
job: ${{ matrix.workflow }}
event_name: ${{ inputs.event_name }}
run_id: ${{ inputs.run_id }}
secrets: inherit
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/AEF-DDF-dispatch.yaml

This file was deleted.

149 changes: 149 additions & 0 deletions .github/workflows/all_jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
on:
workflow_call:
inputs:
job:
required: true
type: string
default: ''
event_name:
required: true
type: string
run_id:
required: true
type: string

jobs:

document:
name: 📖 Check documentation is up to date
if: ${{ inputs.job == 'document' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: roxygen2

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: Commit and push changes
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add man/\* NAMESPACE DESCRIPTION
git commit -m "Update documentation" || echo "No changes to commit"
git pull --ff-only
git push origin
lint:
name: 🔎 Perform linting
if: ${{ inputs.job == 'lint' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true



cleanup:
name: 🧼 Clean up environment
if: ${{ inputs.job == 'pkgdown' && inputs.event_name == 'release' }}
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: 🗑 Delete previous deployments
uses: strumwolf/delete-deployment-environment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: github-pages
onlyRemoveDeployments: true

pkgdown-build:
name: 📖 Render pkgdown output
if: ${{ inputs.job == 'pkgdown' }}
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ inputs.event_name != 'pull_request' || inputs.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: pkgdown
path: docs/

deploy:
name: 🚀 Deploy to GitHub pages
if: ${{ inputs.job == 'pkgdown' && inputs.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [cleanup, pkgdown-build]
steps:
- uses: actions/checkout@v3

- name: Download pkgdown output
uses: actions/download-artifact@v3
with:
name: pkgdown
path: docs

- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
83 changes: 0 additions & 83 deletions .github/workflows/pkgdown.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/test_pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branch: [main, master]
pull_request:
branch: [main, master]
release:
types: [published]
workflow_dispatch:

name: Deploy to GitHub Pages

jobs:
cleanup-build-deploy:
uses: ./.github/workflows/all_jobs.yaml
with:
jobs: ['pkgdown']
event_name: ${{ github.event_name }}
run_id: ${{ github.run_id }}
secrets: inherit
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions reusable/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
inputs:
event_name:
required: true
type: string
run_id:
required: true
secrets:
GITHUB_TOKEN:
required: true
type: string

jobs:

Expand All @@ -33,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ inputs.event_name != 'pull_request' || input.run_id }}
group: pkgdown-${{ inputs.event_name != 'pull_request' || inputs.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
Expand Down

0 comments on commit e29cf95

Please sign in to comment.