在Travis-CI中调用EGO自动更新博客

栏目: 服务器 · 发布时间: 5年前

内容简介:经过一番努力,总于把.travis.ymlauto_publish.el

经过一番努力,总于把 EGO 改到可以无需人工介入自动更新博客了,现在只需要在 source branch中加上两个文件:

.travis.yml

dist: xenial
language: generic

branches:
  only:
    - source

git:
  depth: false
  quiet: true

before_install:
 - git config --global user.email "lujun9972@gmail.com"
 - git config --global user.name "darksun"
 - git clone https://github.com/lujun9972/EGO ~/EGO
 - sudo add-apt-repository ppa:ubuntu-elisp/ppa -y
 - sudo apt-get update
 - sudo apt-get install emacs-snapshot -y
 - emacs-snapshot --version

script:
- git config --global core.quotepath false
- export REPO=$(git remote -v |grep fetch |head -n 1|awk '{print $2}')
- git clone -b source ${REPO} ~/source
- git clone -b master ${REPO} ~/web
- emacs-snapshot --batch -l ./auto_publish.el 

deploy:
  provider: pages
  skip_cleanup: true
  keep_history: true
  github_token: $GITHUB_TOKEN
  local_dir: /home/travis/web
  target_branch: master
  on:
    branch:
      - source

auto_publish.el

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(package-refresh-contents)
(package-install 'mustache)
(package-install 'htmlize)

(setq load-path (cons  "~/EGO/" load-path))
(require 'log-edit)
(require 'htmlize)
(require 'ego)
(setq ego-project-config-alist
 `(("blog" :repository-directory "~/source" :site-domain "https://lujun9972.github.io/" :site-main-title "暗无天日" :site-sub-title "=============>随便,谢谢" :theme
    (emacs_love)
    :summary
    (("years" :year :updates 10)
     ("authors" :authors)
     ("tags" :tags))
    :source-browse-url
    ("Github" ,(getenv "REPO"))
    :personal-disqus-shortname "lujun9972" :personal-google-analytics-id "7bac4fd0247f69c27887e0d4e3aee41e" :ignore-file-name-regexp "README.org" :store-dir "~/web")))
(message "BEGIN TO AUTO PUBLIC")
(setq org-export-use-babel nil)
(setq debug-on-error t)
(ego-do-publication "blog" nil nil nil)

根据自己的需求更改 .travis.yml 中的 git user.emailuser.name 的值,和 auto_publish.elego-project-config-alist 的配置就可以了。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

与机器赛跑

与机器赛跑

[美]埃里克·布林约尔松(Erik Brynjolfsson)、[美]安德鲁·麦卡菲(Andrew McAfee) / 闾佳 / 2013-1-20 / 6.00

一场数字革命正在加速进行。 一些科幻小说里的场景已经在现实中发生:无人驾驶汽车开上了公路;智能设备能高效地翻译人类语言;人工智能系统在智力竞赛里击败了所有人类选手;工厂雇主开始购买更多的新机器,却不招新工人…… 这些例子都证明,数字技术正在快速地掌握原本只属于人类的技能,并深刻地影响了经济。虽然大多数影响是积极的:数字革新将提高效率、降低商品价格(甚至到免费),以及增加经济总量。 ......一起来看看 《与机器赛跑》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具