Vercel 上自动部署你的个人博客 Hugo

#blog

Vercel 可以依托 Git仓库 ,在线自动构建和发布Web静态项目,支持自定义域名,可以自动签发SSL证书,开启HTTPS,还有一个特点,拥有全球CDN,国内速度不错。

支持多套框架和模版,如:Hugo、Jekyll、Hexo、Next、Vue…

注册账号

通过Git仓库账号关联注册,如果注册中出现错误,检查下账号是不是QQ邮箱。 159851540134088415 Vercel不支持QQ邮箱,以GitHub为例,可以修改GitHub的默认邮箱。

GitHub -> Settings -> Emails -> Primary email address

159851526634473314

导入项目

输入你的项目地址 15984828280211707 选择你的账户 15984829290188618 在线安装Vercel 15984829670172789 授权Vercel,选择授权项目

GitHub -> Settings -> Applications -> Vercel -> Configure

159848371700166310 导入项目,选择项目框架 159851472335999113

部署项目

导入项后会自动构建、发布项目,直接访问: https://ichochy.com/
159848411598767311 下次提交代码到Git仓库,Vercel不用任何操作,就可以直接自动构建和发布项目

自定义域名

直接添加已有的域名,域名商管理系统配置域名记录,等待生效。

Vercel -> Project-> Settings -> Domains

159851870725808016 生效后会自动签发SSL证书,开启HTTPS 159851893625696117

指定 Hugo 版本

在项目的环境变量中添加Hugo版本

Vercel -> Project-> Settings -> Environment Variables
HUGO_VERSION 0.74.2

159851902925060418 完成后重新发布

Build Logs

12:21:18.550  	Cloning github.com/iChochy/iChochy.github.io (Branch: master, Commit: a169de0)
12:21:19.212  	Cloning completed in 662ms
12:21:19.213  	Analyzing source code...
12:21:19.799  	Installing build runtime...
12:21:20.194  	Build runtime installed: 394.753ms
12:21:20.575  	Looking up build cache...
12:21:20.638  	Build cache found. Downloading...
12:21:20.647  	Build cache downloaded [206.00 B]: 8.14ms
12:21:21.022  	Installing Hugo version 0.74.2
12:21:23.078  	Installing dependencies...
12:21:23.290  	yarn install v1.22.4
12:21:23.302  	info No lockfile found.
12:21:23.306  	[1/4] Resolving packages...
12:21:23.306  	[2/4] Fetching packages...
12:21:23.309  	[3/4] Linking dependencies...
12:21:23.312  	[4/4] Building fresh packages...
12:21:23.315  	success Saved lockfile.
12:21:23.316  	Done in 0.03s.
12:21:23.515  	Building sites … 
12:21:23.515  	                   | EN   
12:21:23.515  	-------------------+------
12:21:23.515  	  Pages            | 109  
12:21:23.515  	  Paginator pages  |   4  
12:21:23.515  	  Non-page files   |   0  
12:21:23.515  	  Static files     |  13  
12:21:23.515  	  Processed images |   0  
12:21:23.515  	  Aliases          |   1  
12:21:23.515  	  Sitemaps         |   1  
12:21:23.515  	  Cleaned          |   0  
12:21:23.515  	Total in 162 ms
12:21:23.776  	Uploading build outputs...
12:21:31.360  	Build completed. Populating build cache...
12:21:31.457  	Uploading build cache [220.00 B]...
12:21:31.614  	Build cache uploaded: 156.776ms
12:21:31.620  	Done with "config.toml"

源文:https://ichochy.com/posts/20200822/

Comments

comments powered by Disqus