blob: 1eb281441655d17c13cffb54a3395a33caf361b3 (
plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
name: CI
on:
push:
branches:
- main
paths-ignore:
- "README.md"
pull_request:
paths-ignore:
- "README.md"
schedule:
- cron: "13 13 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: write
deployments: write
pull-requests: write
env:
HUGO_CACHEDIR: /tmp/hugo_cache
jobs:
deploy:
runs-on: ubuntu-20.04
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set envs
id: envs
run: |
. ./.env
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
echo "::set-output name=GO_VERSION::${GO_VERSION}"
- uses: peaceiris/workflows/setup-go@v0.13.0
with:
go-version: "${{ steps.envs.outputs.GO_VERSION }}"
cache-path: |
${{ env.HUGO_CACHEDIR }}
cache-key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
cache-restore-keys: |
${{ runner.os }}-hugomod-
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.5.0
with:
hugo-version: "${{ steps.envs.outputs.HUGO_VERSION }}"
extended: true
- uses: denoland/setup-deno@v1
with:
deno-version: 'v1.x'
- run: make fetchdata
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
- run: make cibuild
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2.3
with:
publish-dir: './exampleSite/public'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: false
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
- run: make cibuild-prod
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.8.0
if: ${{ github.ref == 'refs/heads/main' }}
with:
#deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./exampleSite/public
allow_empty_commit: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
lighthouse:
needs: deploy
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-20.04
timeout-minutes: 2
steps:
- uses: actions/setup-node@v3.1.1
with:
node-version: "14"
- name: Install lighthouse
run: sudo npm i -g lighthouse
- name: Run lighthouse
run: |
lighthouse \
--chrome-flags="--headless" \
--output html --output-path ./report.html \
'https://hugothemeiris.peaceiris.app'
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: lighthouse-report
path: report.html
- name: Prepare assets
run: |
mkdir ./public
cp ./report.html ./public/report.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.8.0
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./public
keep_files: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
docker:
runs-on: ubuntu-20.04
timeout-minutes: 2
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ${{ env.HUGO_CACHEDIR }}
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: prepare
run: |
sed -i 's/enableGitInfo: true/# enableGitInfo: true/' exampleSite/config/_default/config.yaml
- run: make build
setup:
runs-on: ubuntu-20.04
timeout-minutes: 2
if: ${{ github.ref == 'refs/heads/main' }}
strategy:
matrix:
extended:
- true
- false
steps:
- uses: actions/checkout@v3
- name: Set envs
id: envs
run: |
. ./.env
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
echo "::set-output name=GO_VERSION::${GO_VERSION}"
- uses: peaceiris/workflows/setup-go@v0.13.0
with:
go-version: "${{ steps.envs.outputs.GO_VERSION }}"
cache-path: |
${{ env.HUGO_CACHEDIR }}
cache-key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
cache-restore-keys: |
${{ runner.os }}-hugomod-
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.5.0
with:
hugo-version: "${{ steps.envs.outputs.HUGO_VERSION }}"
extended: ${{ matrix.extended }}
- name: Setup Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Create a new Hugo project
run: |
mkdir ~/homepage
cp scripts/setup.sh ~
cd ~
bash ./setup.sh "homepage" "peaceiris"
cd homepage
hugo
|