diff --git a/.github/workflows/bookdown.yaml b/.github/workflows/bookdown.yaml new file mode 100644 index 0000000..9430835 --- /dev/null +++ b/.github/workflows/bookdown.yaml @@ -0,0 +1,74 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help + +name: CI-CD + +on: + # Triggered on push and pull request events + push: + pull_request: + # Allow manual runs from the Actions tab + workflow_dispatch: + +jobs: + CI-CD: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + # We keep a matrix for convenience, but we would always want to run on one + # single OS and R version + matrix: + config: + - {os: ubuntu-latest, r: 'release'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + + - name: Checkout repo + uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + use-public-rspm: true + + - name: Install and cache dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + + - name: Build site + run: | + bookdown::render_book("index.Rmd", "bookdown::gitbook") + shell: Rscript {0} + + - name: Upload built site artifact + uses: actions/upload-artifact@v1 + with: + name: site + path: _book + + - name: Test website + uses: docker://klakegg/html-proofer:3.18.8 + with: + args: _book + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/master' + # TODO: consider switching to JamesIves/github-pages-deploy-action + # uses: JamesIves/github-pages-deploy-action@4.1.4 + # with: + # branch: gh-pages + # folder: _book + uses: crazy-max/ghaction-github-pages@v2.2.0 + with: + target_branch: gh-pages + build_dir: _book + jekyll: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml deleted file mode 100644 index ed7650c..0000000 --- a/.github/workflows/pkgdown.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - release: - types: [published] - workflow_dispatch: - -name: pkgdown - -jobs: - pkgdown: - runs-on: ubuntu-latest - # Only restrict concurrency for non-PR jobs - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - permissions: - contents: write - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::pkgdown, local::. - needs: website - - - name: Build site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) - shell: Rscript {0} - - - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - clean: false - branch: gh-pages - folder: docs