WIP #644
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
name: Lecture Notes | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
lecture-notes: | |
if: "contains(github.event.head_commit.message, 'lecture') && !contains(github.event.head_commit.message, 'merge') && !contains(github.event.head_commit.message, 'WIP')" | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: "actions checkout" | |
uses: actions/checkout@v3 | |
- name: "Setup pandoc" | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: "Setup Quarto" | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: "Install curl for Bioconductor" | |
run: | | |
sudo apt -y install libcurl4-openssl-dev | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Setup renv | |
uses: r-lib/actions/setup-renv@v2 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
tinytex: true | |
- uses: r-lib/actions/setup-tinytex@v2 | |
- run: tlmgr --version | |
- name: Install additional LaTeX packages | |
run: | | |
tlmgr install titlesec | |
tlmgr install svg | |
tlmgr install transparent | |
tlmgr install tikzfill | |
tlmgr install sidenotes | |
tlmgr install marginnote | |
tlmgr install changepage | |
tlmgr list --only-installed | |
- name: Restore R package cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Install R dependencies | |
run: | | |
if (!requireNamespace("remotes", quietly = TRUE)) {install.packages("remotes", dependencies = TRUE, quiet = TRUE, verbose = FALSE)} | |
remotes::install_deps(dependencies = TRUE) | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv", dependencies = TRUE, quiet = TRUE, verbose = FALSE) | |
renv::restore() | |
if (!requireNamespace("fs", quietly = TRUE)) install.packages("fs", dependencies = TRUE, quiet = TRUE, verbose = FALSE) | |
if (!requireNamespace("quarto", quietly = TRUE)) install.packages("quarto", dependencies = TRUE, quiet = TRUE, verbose = FALSE) | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
shell: Rscript {0} | |
- name: "Render lecture-notes" | |
shell: Rscript {0} | |
run: | | |
source("./R/update-lecture-notes.R") | |
- name: Commit results to main branch | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add . | |
git commit -m "CI added changes `date +'%Y-%m-%d %H:%M:%S'`" || echo "No changes to commit" | |
git push origin || echo "No changes to commit" | |
- name: Push changes # push the output folder to your repo | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
github_token: ${{ secrets.API_TOKEN_GITHUB }} | |
# WORKFLOW_GITHUB_TOKEN | |
force: true | |
- name: Pushes to patoloji-ders-notlari | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'ders-notlari' | |
destination-github-username: 'sbalci' | |
destination-repository-name: 'patoloji-ders-notlari' | |
user-email: [email protected] | |
target-branch: main | |
- name: Pushes to patoloji-ders-sunumlari | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source-directory: 'ders-sunumlari' | |
destination-github-username: 'sbalci' | |
destination-repository-name: 'patoloji-ders-sunumlari' | |
user-email: [email protected] | |
target-branch: main |