deploy from "website" action
authorFrançois Michonneau <francois.michonneau@gmail.com>
Fri, 18 Dec 2020 14:26:14 +0000 (15:26 +0100)
committerFrançois Michonneau <francois.michonneau@gmail.com>
Wed, 6 Jan 2021 14:22:46 +0000 (15:22 +0100)
.github/workflows/website.yml

index f58e9c804ea11a4f9b69b2705a5b4e23f70bb2ff..719b39dbfea94569d3d60b236fdc2cac1f6a7c7f 100644 (file)
@@ -9,7 +9,7 @@ jobs:
     runs-on: ubuntu-latest
     env:
       RSPM: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"
-      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
     defaults:
       run:
         shell: bash
@@ -82,6 +82,24 @@ jobs:
           done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
 
       - run: make site
+
+      - name: Setup Git
+        if: ${{ steps.check-rmd.outputs.count != 0 }}
+        run: |
+          git config --local user.email "actions@github.com"
+          git config --local user.name "GitHub Actions"
+          git status
+
+      - name: Push site
+        if: ${{ github.event.push == 'true' && steps.check-rmd.outputs.count != 0 && github.ref == 'refs/head/main' }}
+        run: |
+          git checkout --orphan gh-pages
+          git add .
+          git commit -m "[GitHub Actions] render website"
+          git remote -v
+          git status
+          git push origin gh-pages
+
       - run: make lesson-check
         if: always()
       - run: make lesson-check-all