Monthly Release #33
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: Monthly Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 1 * *' | |
jobs: | |
monthly-release: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
env: | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install rsvg-convert | |
run: sudo apt-get update && sudo apt-get install -y librsvg2-bin | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
# - name: Setup renv | |
# uses: r-lib/actions/setup-renv@v2 | |
- 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) | |
if (!requireNamespace("xfun", quietly = TRUE)) {install.packages("xfun", dependencies = TRUE, quiet = TRUE, verbose = FALSE)} | |
if (!requireNamespace("readxl", quietly = TRUE)) {install.packages("readxl", dependencies = TRUE, quiet = TRUE, verbose = FALSE)} | |
if (!requireNamespace("tinytex", quietly = TRUE)) {install.packages("tinytex, dependencies = TRUE, quiet = TRUE, verbose = FALSE")} | |
if (!tinytex::is_tinytex()) {tinytex::install_tinytex()} | |
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: "epub word TR" | |
shell: Rscript {0} | |
run: | | |
source("./R/render_epub_word_TR.R") | |
continue-on-error: true | |
- name: "Install epubcheck" | |
run: sudo apt-get update && sudo apt-get install -y epubcheck | |
- name: "Check epub TR" | |
run: epubcheck ./_epub_word_TR/Patoloji-Atlasi.epub | |
continue-on-error: true | |
- name: "pdf TR" | |
shell: Rscript {0} | |
run: | | |
source("./R/render_pdf_TR.R") | |
continue-on-error: true | |
- name: "epub word EN" | |
shell: Rscript {0} | |
run: | | |
source("./R/render_epub_word_EN.R") | |
continue-on-error: true | |
- name: "Check epub EN" | |
run: epubcheck ./_epub_word_EN/HistoPatology-Atlas.epub | |
continue-on-error: true | |
- name: "pdf EN" | |
shell: Rscript {0} | |
run: | | |
source("./R/render_pdf_EN.R") | |
continue-on-error: true | |
- name: Get current date | |
id: current_date | |
run: echo "DATE=$(date +'%Y-%m')" >> $GITHUB_ENV | |
- name: Prepare files list | |
id: prep_files | |
run: | | |
FILES="" | |
for file in ./_epub_word_TR/Patoloji-Atlasi.epub \ | |
./_epub_word_TR/Patoloji-Atlasi.docx \ | |
./_pdf_TR/Patoloji-Atlasi.pdf \ | |
./_epub_word_EN/HistoPatology-Atlas.epub \ | |
./_epub_word_EN/HistoPatology-Atlas.docx \ | |
./_pdf_EN/HistoPathology-Atlas.pdf; do | |
if [ -f "$file" ]; then | |
FILES="$FILES$file\n" | |
fi | |
done | |
echo "::set-output name=files_list::$(echo -e $FILES)" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: release-${{ env.DATE }} | |
release_name: Release for ${{ env.DATE }} | |
draft: false | |
prerelease: false | |
body: | | |
Epub, Word & Pdf generated for the month of ${{ env.DATE }} | |
files: | | |
${{ steps.prep_files.outputs.files_list }} | |
# - name: Release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# tag_name: release-${{ env.DATE }} | |
# release_name: Release for ${{ env.DATE }} | |
# draft: false | |
# prerelease: false | |
# body: | | |
# Epub, Word & Pdf generated for the month of ${{ env.DATE }} | |
# files: | | |
# ./_epub_word_TR/Patoloji-Atlasi.epub | |
# ./_epub_word_TR/Patoloji-Atlasi.docx | |
# ./_pdf_TR/Patoloji-Atlasi.pdf | |
# ./_epub_word_EN/HistoPatology-Atlas.epub | |
# ./_epub_word_EN/HistoPatology-Atlas.docx | |
# ./_pdf_EN/HistoPathology-Atlas.pdf | |