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

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

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

注册账号

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

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

导入项目

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

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

导入项目,选择项目框架

部署项目

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

自定义域名

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

Vercel -> Project-> Settings -> Domains

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

指定 Hugo 版本

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

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

完成后重新发布

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.html


如果对您有帮助,请点

你可能感兴趣的:(hugobloghttps)