build-deploy-rmd #254
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: '0 9 * * 3' | |
workflow_dispatch: | |
name: build-deploy-rmd | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
# permissions: | |
# contents: read | |
# pages: write | |
# id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
# concurrency: | |
# group: "pages" | |
# cancel-in-progress: false | |
jobs: | |
build-rmd: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macOS-latest, r: 'release'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
CRAN: ${{ matrix.config.cran }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
- name: Set up pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
## rcrossref requires an email address associated with a query | |
- name: Set up crossref email | |
run: | | |
echo crossref_email=\"${{ secrets.CROSSREF_EMAIL }}\" >> ~/.Renviron | |
- name: Install dependencies | |
run: | | |
install.packages(c('remotes', 'dplyr', 'ggplot2', 'rmarkdown', | |
'knitr', 'tibble', 'tidyr', | |
'lubridate', 'gh', 'jsonlite', 'purrr', | |
'DT', 'plotly', 'citecorp', 'readr', | |
'viridis', 'wordcloud', 'stringr', 'gt', | |
'rworldmap', 'openalexR'), Ncpu = 2L) | |
remotes::install_github('ropensci/rcrossref') | |
shell: Rscript {0} | |
- name: Session info | |
run: | | |
install.packages('sessioninfo', Ncpus = 2L) | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
- name: Render site | |
run: | | |
rmarkdown::render(input = "joss-submission-analytics.Rmd", clean = FALSE) | |
shell: Rscript {0} | |
- name: Prepare files to deploy | |
run: | | |
mkdir _site | |
touch _site/.nojekyll | |
cp -r joss-submission-analytics_files joss-submission-analytics.html _site/ | |
cp -r joss_submission_analytics.rds _site/ | |
cp -r joss_submission_citations_byjournal.tsv _site/ | |
cp -r joss_submission_citations.tsv _site/ | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: _site | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check | |
- name: upload artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: submissionanalytics | |
path: joss_submission_analytics.rds | |
## From 2024-06-30, need to use GitHub Actions for deployment | |
# - name: Setup Pages | |
# uses: actions/configure-pages@v5 | |
# | |
# - name: Build with Jekyll | |
# uses: actions/jekyll-build-pages@v1 | |
# with: | |
# source: ./_site | |
# destination: ./_site_jkl | |
# | |
# - name: Upload artifact | |
# uses: actions/upload-pages-artifact@v3 | |
# with: | |
# path: ./_site_jkl | |
# Deployment job | |
# deploy: | |
# environment: | |
# name: github-pages | |
# url: ${{ steps.deployment.outputs.page_url }} | |
# runs-on: ubuntu-latest | |
# needs: build-rmd | |
# | |
# steps: | |
# - name: Deploy to GitHub Pages | |
# id: deployment | |
# uses: actions/deploy-pages@v4 |