From 8d37c0b6081c166e19d6369cc03a19afe3fb5781 Mon Sep 17 00:00:00 2001 From: Kristof Van Der Haeghen Date: Fri, 26 Jan 2024 10:45:57 +0100 Subject: [PATCH] Adding custom github action to render and deploy the website. --- .github/workflows/github-action-pages.yml | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/github-action-pages.yml diff --git a/.github/workflows/github-action-pages.yml b/.github/workflows/github-action-pages.yml new file mode 100644 index 0000000..3bc8e76 --- /dev/null +++ b/.github/workflows/github-action-pages.yml @@ -0,0 +1,43 @@ +on: + push: + branches: + - master + - main +name: Render & Deploy Site +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up R + uses: r-lib/actions/setup-r@v2 + - name: Set up Pandoc + - uses: r-lib/actions/setup-pandoc@v2 + - name: Install dependencies + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + - name: Render Site + run: Rscript -e 'rmarkdown::render_site(input = "webBuild", output_format = "all" envir = parent.frame(), quiet = FALSE, encoding = "UTF-8")' + - name: Commit results + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git add -A + git commit -m 'Rebuild site' || echo "No changes to commit" + git push origin || echo "No changes to commit" + deploy: + permissions: + contents: read + pages: write + id-token: write + runs-on: ubuntu-latest + needs: jekyll-build + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + steps: + - name: Deploy artifact + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file