侧边栏壁纸
博主头像
进一步,海阔天空 博主等级

进一步,海阔天空

  • 累计撰写 140 篇文章
  • 累计创建 19 个标签
  • 累计收到 7 条评论

目 录CONTENT

文章目录

Hugo+Gitea+Drone个人博客发布

海阔天空
2022-05-27 / 0 评论 / 0 点赞 / 373 阅读 / 0 字

内容提要

由于个人博客是放在Gitea里面的,如果每次写好博文,都要生成一次静态页面并发布到服务器上,显然过于繁琐,因此本文介绍了如何结合Drone实现博文的自动生成和发布工作。

hugo配置

修改Hugo项目根目录下的config.toml文件。主要是修改网站URL,主题等。

baseURL = "http://blog.xxx.com/"
theme = "anatole"
buildDrafts = true

Drone配置

在项目根目录下创建.drone.yml文件,加入如下配置。

kind: pipeline
name: default
clone:
  skip_verify: true
steps:
  - name: build
    image: plugins/hugo
    commands:
      - git clone https://github.com/lxndrblz/anatole.git themes/anatole
      - hugo --config config.toml
  - name: publish
    image: appleboy/drone-scp
    settings:
      host: blog.xxx.com
      username: {username} #登录用户
      password:
        from_secret: ssh_xxx_password #登录密码,从drone的加密文件中读取,最好不要写明码
      port: 22
      target: /usr/share/nginx/html/blog.xxx.com
      source: public

OK,一切就绪,commit并push到gitea,然后就可以在drone中看到网站自动构建并发布了,是不是很香??
drone

0

评论区