手动部署
- 注意,git仓库需要是public的;下面自动的不用
自动部署
Netlify
参考Netlify部署Hugo个人博客 及 Hugo Algolia搜索及Netlify自动化处理 ,这位博主写的很详细了,我就不写了。
AWS Amplify
Vercel
贴下几个文件
1
2
3
4
| .env
node_modules
.idea
.vscode
|
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
| [build]
publish = "public"
command = "hugo --gc --minify --theme=even && npm install atomic-algolia --save && npm run algolia"
[context.production.environment]
HUGO_VERSION = "0.101.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
[context.split1]
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.101.0"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.101.0"
[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.101.0"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"
[[redirects]]
from = "/npmjs/*"
to = "/npmjs/"
status = 200
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| version: 1
frontend:
phases:
preBuild:
commands:
- wget https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_extended_${VERSION_HUGO}_Linux-64bit.tar.gz
- tar --overwrite -xf hugo_extended_${VERSION_HUGO}_Linux-64bit.tar.gz hugo
- mv hugo /usr/bin/hugo
- rm -rf hugo_extended_${VERSION_HUGO}_Linux-64bit.tar.gz
- hugo version
- hugo --gc --minify --buildFuture
- npm install atomic-algolia --save
build:
commands:
- hugo --gc --minify --theme=loveit --enableGitInfo=false
- npm run algolia
artifacts:
baseDirectory: public
files:
- '**/*'
cache:
paths:
- node_modules/**/*
|