From a8ce8219b1a07093021aae647d8518a3427d039b Mon Sep 17 00:00:00 2001 From: Zhang Fuxin Date: Wed, 27 Oct 2021 19:36:26 +0800 Subject: [PATCH] add .github with bookdown workflow --- .github/workflow/deploy_bookdown.yml | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflow/deploy_bookdown.yml diff --git a/.github/workflow/deploy_bookdown.yml b/.github/workflow/deploy_bookdown.yml new file mode 100644 index 0000000..997f6e7 --- /dev/null +++ b/.github/workflow/deploy_bookdown.yml @@ -0,0 +1,49 @@ +on: + push: + branches: + - main + +name: renderbook + +jobs: + bookdown: + name: Render-Book + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v1 + - name: Install rmarkdown + run: Rscript -e 'install.packages(c("rmarkdown","bookdown", "dplyr","knitr","flextable", "readr", "ftExtra","officer"))' + - name: Render Book + run: make + - uses: actions/upload-artifact@v1 + with: + name: _book + path: _book/ + +# Need to first create an empty gh-pages branch +# see https://pkgdown.r-lib.org/reference/deploy_site_github.html +# and also add secrets for a GH_PAT and EMAIL to the repository +# gh-action from Cecilapp/GitHub-Pages-deploy + checkout-and-deploy: + runs-on: ubuntu-latest + needs: bookdown + steps: + - name: Checkout + uses: actions/checkout@master + - name: Download artifact + uses: actions/download-artifact@v1.0.0 + with: + # Artifact name + name: _book # optional + # Destination path + path: _book # optional + - name: Deploy to GitHub Pages + uses: Cecilapp/GitHub-Pages-deploy@master + env: + EMAIL: ${{ secrets.EMAIL }} # must be a verified email + GH_TOKEN: ${{ secrets.GH_PAT }} # https://github.com/settings/tokens + BUILD_DIR: _book/ # "_site/" by default + +