-
Notifications
You must be signed in to change notification settings - Fork 35
110 lines (87 loc) · 2.82 KB
/
build-site.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build Site
on:
push:
branches:
- "*"
- "!staging.tmp"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 1/4 * *" # every 4 days
jobs:
build_site:
name: "Zola Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Download Zola"
run: curl -sL https://github.com/getzola/zola/releases/download/v0.16.1/zola-v0.16.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv
- name: "Build Site"
run: ./zola build
- name: Upload Generated Site
uses: actions/upload-artifact@v4
with:
name: generated_site
path: public
zola_check:
name: "Zola Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Download Zola"
run: curl -sL https://github.com/getzola/zola/releases/download/v0.16.1/zola-v0.16.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv
- name: "Run zola check"
run: ./zola check
check_spelling:
name: "Check Spelling"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: curl -L https://git.io/misspell | bash
name: "Install misspell"
- run: bin/misspell -error content
name: "Check for common typos using `misspell`"
# Executes "typos ."
- uses: crate-ci/[email protected]
name: "Check for common typos using `typos`"
deploy_site:
name: "Deploy Generated Site"
runs-on: ubuntu-latest
needs: [build_site, check_spelling]
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'rust-osdev/homepage'
permissions:
contents: write
steps:
- name: "Download Generated Site"
uses: actions/[email protected]
with:
name: generated_site
path: generated_site
- name: Check out gh-pages branch
uses: actions/checkout@v2
with:
ref: "gh-pages"
path: "gh-pages"
- name: "Set Up Git Identity"
run: |
git config --local user.name "GitHub Actions Deploy"
git config --local user.email "[email protected]"
working-directory: "gh-pages"
- name: "Delete Old Content"
run: "rm -r ./*"
working-directory: "gh-pages"
- name: "Add New Content"
run: cp -r generated_site/* gh-pages
- name: "Commit New Content"
run: |
git add .
git commit --allow-empty -m "Deploy ${GITHUB_SHA}
Deploy of commit https://github.com/rust-osdev/homepage/commit/${GITHUB_SHA}"
working-directory: "gh-pages"
- name: "Show Changes"
run: "git show"
working-directory: "gh-pages"
- name: "Push Changes"
run: "git push"
working-directory: "gh-pages"