Linux/mac fix for setup (#178) #572
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Website | |
on: | |
push: | |
branches: | |
- 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@v4 | |
- 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 | |
check: | |
needs: container | |
runs-on: ubuntu-latest | |
container: ghcr.io/${{github.repository}}:latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout github pages | |
uses: actions/checkout@v4 | |
- name: Build site | |
run: | | |
make site | |
build-website: | |
needs: container | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}} | |
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 github pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
fetch-depth: 0 | |
- name: Set up git | |
run: | | |
git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
- name: Merge | |
run: | | |
git fetch origin | |
git merge origin/main | |
- name: Render the markdown and confirm that the site can be built | |
run: make site | |
- name: Commit and Push | |
run: | | |
rm -r _site | |
git add -A . | |
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})" | |
git push origin gh-pages | |
- run: make lesson-check-all | |
if: always() |