feat(GH Actions): Specify R version(keep back) #234
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: | |
workflow_dispatch: | |
push: | |
branches: main | |
name: Quarto Publish | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install ubuntu dependencies | |
#run: sudo apt install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev libudunits2-dev libgdal-dev | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: >- | |
libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev | |
libudunits2-dev libgdal-dev libarchive-dev libmagick++-dev | |
#execute_install_scripts: true | |
version: 1 | |
- name: Install mamba environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: pyenv/base/environment.yml | |
#init-shell: bash | |
cache-environment: true | |
cache-environment-key: ${{ runner.os }}-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('pyenv/base/environment.yml') }} | |
- name: activate conda environment | |
run: | | |
eval "$(micromamba shell hook --shell bash)" | |
micromamba activate baseline | |
which python | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.4.1' | |
Ncpus: '4' | |
- name: Install R dependency | |
uses: r-lib/actions/setup-renv@v2 | |
with: | |
profile: '"armyknives"' | |
#bypass-cache: never | |
#working-directory: "quarto/data/1_swiss_army_knives/" | |
cache-version: 3 | |
#- name: "Setup pandoc" | |
# uses: r-lib/actions/setup-pandoc@v2 | |
# with: | |
# pandoc-version: latest | |
#- run: | | |
# which pandoc | |
# pandoc --version | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
#with: | |
# version: pre-release | |
#- run: sudo cp -f /opt/hostedtoolcache/pandoc/3.5/x64/pandoc /opt/quarto/bin/tools/ | |
- name: Restore cached shinylive dependencies | |
id: cache-shinylive-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
/home/runner/.cache/shinylive | |
key: ${{ runner.os }}-shinylive-${{ hashFiles('**/shinystandalone/index.qmd') }} | |
- name: Quarto render - to inspect rendering cache | |
run: quarto render ./posts/ --use-freezer | |
- name: Push Quarto render cache if diff detected | |
run: | | |
git config --global user.name 'YONGHUNI' | |
git config --global user.email '[email protected]' | |
git pull | |
git add -f _freeze .quarto | |
( git commit -m "[BOT]Quarto Freeze by GH actions" && git push ) || echo "Nothing to Push.. Skipping the Push Process" | |
- run: | | |
sudo chmod -R 777 /home/runner/work/blog/blog | |
- name: Render and Publish | |
uses: quarto-dev/quarto-actions/publish@v2 | |
with: | |
target: gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save cache | |
id: cache-shinylive-save | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
/home/runner/.cache/shinylive | |
key: ${{ steps.cache-shinylive-restore.outputs.cache-primary-key }} | |