分层正态模型与 Stan (#116) #985
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: main | |
pull_request: | |
branches: main | |
# to be able to trigger a manual build | |
workflow_dispatch: | |
schedule: | |
# 每周四 早上 7 点 | |
- cron: '0 23 * * 3' | |
name: Book-Fedora | |
env: | |
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }} | |
RUST_BACKTRACE: 1 | |
jobs: | |
build-deploy: | |
if: "!contains(github.event.head_commit.message, '[docker]')" | |
runs-on: ubuntu-22.04 | |
env: | |
CMDSTAN_VERSION: "2.33.1" | |
container: | |
image: ghcr.io/xiangyunhuang/fedora-rstudio-pro:1.4.395 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
volumes: | |
- ${{ github.workspace }}:/home/docker | |
ports: | |
- 8383:8787 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Render Book (all) | |
if: github.event_name == 'push' | |
run: | | |
quarto render | |
shell: bash | |
env: | |
RETICULATE_PYTHON_ENV: /opt/.virtualenvs/r-tensorflow | |
RETICULATE_PYTHON: /opt/.virtualenvs/r-tensorflow/bin/python | |
CMDSTAN: /opt/cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }} | |
- name: Render Book (html) | |
if: github.event_name != 'push' | |
run: | | |
quarto render --to html | |
shell: bash | |
env: | |
RETICULATE_PYTHON_ENV: /opt/.virtualenvs/r-tensorflow | |
RETICULATE_PYTHON: /opt/.virtualenvs/r-tensorflow/bin/python | |
CMDSTAN: /opt/cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }} | |
- name: Deploy to Netlify | |
if: contains(env.isExtPR, 'false') | |
id: netlify-deploy | |
uses: nwtgck/actions-netlify@v2 | |
with: | |
publish-dir: './_book' | |
production-branch: main | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: | |
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})' | |
enable-pull-request-comment: true | |
enable-commit-comment: true | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 10 | |
- name: Deploy book to bookdown.org | |
if: github.event_name == 'push' | |
env: | |
CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_TOKEN }} | |
CONTENT_ID: ${{ secrets.RSC_BOOKDOWN_APP_ID }} | |
run: | | |
Rscript '_deploy.R' | |
shell: bash | |
- name: Upload book folder for debug | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Upload Book | |
path: _book |