Write blog posts through Issues and automatically deploy to GH-Page.
introduce
- acyortEngine core, which manages plug-ins, workflows, and
html
Output, etc. - acyort-donob-pluginsIs:
acyort
Plugin for pullingissues
After processing, the corresponding template will be rendered.
The overall steps
- Create a new repO on Github
- Write configuration file
- addgithub token, permissions for
repo::public_repo
- incircleCiAdd the corresponding
repo
And createcircleci token(Need to be saved) - in
circleci
The corresponding project is added tovariable
. - in
repo
addwebhook
- write
issues
About gh – pages
Gh-pages are available in two forms, please refer to the official instructions for details:
-
The project named username.github. IO is the User page assigned to each user.
-
The other is the Prject Page, the GH-Pages generated in each project through the GH-Pages branch or through the Docs folder.
No matter, in what way to establish gh-Pages can be.
However, if the repO is created as username.github. IO, the content can only be stored in the Master branch and cannot be generated in the GH-Pages or docs folder like other repOs.
Github. IO to create gh-pages
The detailed steps
Create a repo
- To create a
username.github.io
therepo
Is responsible for receiving generatedhtml
Content, and generateuser page
. - To create a
blog-config
(name optional), for managementblog
Configuration, andissues
Management.
Apply for two tokens
Both tokens must be saved by themselves. If you close them, they will not be recovered.
-
github token
Apply for a Github token with write permission. Scope selects repo::public_repo, which is used to push generated files directly into the project through the API.
-
circleci token
Apply for a Circleci token to trigger a Circle build via webhook.
Write configuration file
In blog-config, create the following files:
| - circleci | - config. Yml / / circleci configuration file | - config. Yml / / acyort configuration file | - package. Json / / the needless to sayCopy the code
-
package.json
{ "name": "blog name"."version": "1.0.0"."description": "blog"."main": "index.js"."scripts": { "deploy": "acyort flow" }, "dependencies": { "acyort": "^ 3.1.1." "."acyort-donob-renderer": "^ 1.5.0." "."acyort-plugin-fetch-issues": "^ 1.3.1." "."acyort-plugin-rss": "^ 1.5.0." "."acyort-templates-donob-plus": "^ 1.5.1." "."gh-pages": "^ 2.0.1." "}}Copy the code
-
Config.yml (Acyort configuration file)
title: blog name # Blog name description: blog desc # Blog Profile url: http://username.github.io # blog url template: acyort-templates-donob-plus menu: Archives: /archives/ Tags: /tags/ repository: username/blog-config # Write projects for issues public: public timezone: Asia/Shanghai plugins: - acyort-plugin-fetch-issues - acyort-donob-renderer Copy the code
-
.circleci/config.yml
# Notice that this file is called config.yml and is in the.circleci directory version: 2 jobs: build: docker: - image: node:latest working_directory: ~/acyort branches: only: - master steps: - checkout - restore_cache: keys: - yarn-packages-{{ checksum "yarn.lock" }} - run: yarn install - save_cache: name: Save Yarn Package Cache key: yarn-packages-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn - run: yarn deploy - run: git config user.name "" # your github username - run: git config user.email "" # Your Github email - run: npx gh-pages -d public -r https://${gh_token}@github.com/username/username.github.io.git -b master -m "Updated by circleci - `date`" # ${gh_token}, which is a Github token with write permission, will be configured in circleci. Copy the code
Configuration circleci
- will
blog-config
Project joincircleci
In the. - choose
linux
andnode
The environment. - point
start build
, should befail
Because thegh_token
It has not been added to the environment variable. - Click on the left-hand column
Job
To findblog-config
Project, click Settings - in
BUILD SETTINGS
Found in theEnvironment Variables
- Click on the
Add variable
name
forgh_token
(The name should followconfig.yml
In the${gh_token}
),value
Fill in the one you just applied forgh-token
.- Go back to
circleci
In the project, click on the last onebuild fail
Entry, in the upper right cornerrebuild
- Barring accidents, we should succeed now
build
And,username.github.io
This repository also has corresponding files.
Configuration webhook
Go back to the blog-config project to configure
- point
settings
- point
webhook
- point
Add webhook
Payload URL
Fill in the ‘https://circleci.com/api/v1.1/project/github/:username/:project/tree/:branch?circle-token=:token’ (to replace the corresponding field), one of them:token
fromcircleci
The application oftoken
)Content-Type
chooseapplication/json
- The following option
let me select xxx
And check theissues
options - Click on the bottom
save
- complete
Write free
At this point, the blog has been set up, just need to write issues in blog-config, and it will be synchronously deployed to GH-Pages.
The last
For more configurations, see
- acyort
- acyort-donob-plugins
- blog-config