generated from carpentries-incubator/template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
89 lines (75 loc) · 2.32 KB
/
website.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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()