Skip to content

Highlighting reviews - documentation and readme links #535

Highlighting reviews - documentation and readme links

Highlighting reviews - documentation and readme links #535

Workflow file for this run

name: Website
on:
push:
branches:
# - gh-pages
- main
pull_request: []
jobs:
container:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
push: true # Will only build if this is not here
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:latest
build-website:
needs: container
runs-on: ubuntu-latest
container: ghcr.io/${{github.repository}}:latest
env:
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell: bash
steps:
- name: Checkout the lesson
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Render the markdown and confirm that the site can be built
run: make site
- name: Checkout github pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: actions/checkout@master
with:
ref: gh-pages
path: gh-pages
- name: Commit and Push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: |
# clean up gh-pages (source: https://github.com/zkamvar/styles/blob/ed29df30623a68ae87e05811a01283f0452fae4e/.github/workflows/website.yml)
cd gh-pages
git rm -rf . # remove all previous files
git restore --staged . # remove things from the stage
cd ..
# copy everything into gh-pages site
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
# move into gh-pages, add, commit, and push
cd gh-pages
# setup git
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add -A .
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
git push origin gh-pages
# return
cd ..
- run: make lesson-check-all
if: always()