forked from sma11black/hexo-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08f5143
commit 01c8e94
Showing
4 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
# GitHub Action - Hexo CI/CD 🌱 | ||
# GitHub Action - Hexo CI/CD with Gulp Support 🌱 | ||
|
||
<a href="https://github.com/marketplace/actions/hexo-action"><img alt="View Action" src="https://img.shields.io/badge/action-marketplace-blue.svg?logo=github&color=orange"></a> | ||
<a href="https://github.com/marketplace/actions/hexo-gulp-action"><img alt="View Action" src="https://img.shields.io/badge/action-marketplace-blue.svg?logo=github&color=orange"></a> | ||
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-green.svg?logo=github"></a> | ||
|
||
This Github Action automating hexo deployment workflow, to allow you to leverage GitHub Actions to publish your hexo site on Github Pages. | ||
NOTE: Fork from: <https://github.com/sma11black/hexo-action> | ||
|
||
This Github Action automating hexo deployment workflow, to allow you to leverage GitHub Actions to publish your hexo site on Github Pages and Gulp Support to minimal Hexo website. | ||
|
||
## 🍑Usage | ||
### 🍄Pre-requisites | ||
#### Step 1: Setup `Deploy keys` and `Secrets` | ||
|
||
The `with` portion of the workflow **must** be configured before the action will work. You can add these in the `with` section found in the [example workflow](#🍌example-workflow---hexo-deploy) below. Any `secrets` must be referenced using the bracket syntax and stored in the GitHub repositories `Settings/Secrets` menu. You can learn more about setting environment variables with GitHub actions [here](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsenv). | ||
|
||
**🥕How to add your ssh key pair?** | ||
|
||
1. Run the following terminal command, replacing the email with one connected to your GitHub account. | ||
```sh | ||
$ ssh-keygen -t rsa -C "[email protected]" | ||
|
@@ -19,9 +23,11 @@ $ ssh-keygen -t rsa -C "[email protected]" | |
3. In *hexo source code* repo: Add the contents of the private key to the `Settings > Secrets` menu as DEPLOY_KEY. | ||
|
||
#### Step 2: Configure github workflows | ||
|
||
Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#🍌example-workflow---hexo-deploy) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file). | ||
|
||
### 🍆Inputs | ||
|
||
For more information on these inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input) | ||
|
||
| Key | Required | Description | Default | | ||
|
@@ -36,15 +42,18 @@ For more information on these inputs, see the [API Documentation](https://develo | |
- [1] 41898282 is the user ID for `github-actions[bot]`. Ref [Github API](https://api.github.com/users/github-actions[bot]/events/public). | ||
|
||
**Tips**: | ||
|
||
- `user_name` and `user_email`: Github Actions bot is just a bot account to perform these operations so that users would know that they were triggered by automation. There is an known issue if you use this bot account. In your GitHub Pages repository, if you want to filter commits by author, it will return a wrong result: `No commits found for "github-actions[bot]"`. You can avoid such error by using your github account instead of default bot account. | ||
- `commit_msg`: For [Hexo official](https://hexo.io/docs/one-command-deployment.html#Git), the commit message is default to `Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`. But for users who actually need to keep commit history, they may not need such one. So the recommended setting is `${{ github.event.head_commit.message }}` so that you can transfer commit messages to the GitHub Pages repository directly. If you prefer the default commit message, it is unnecessary to set in your workflow file or set `commit_msg` to `default`. For users who don’t want any commit history, you can set `commit_msg` to `none`. Since `default` and `none` are reserved words for control, you cannot set the commit message to these two words alone. | ||
|
||
### 🥒Outputs | ||
|
||
For more information on these outputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#response-4) for an example of what these outputs look like | ||
|
||
- `notify`: Deploy complate notification. | ||
|
||
### 🍌Example workflow - hexo deploy | ||
|
||
On every `push` to this repo, generate hexo sites and publish on `username.github.io` repo. | ||
|
||
```yaml | ||
|
@@ -78,7 +87,7 @@ jobs: | |
# Deploy hexo blog website. | ||
- name: Deploy | ||
id: deploy | ||
uses: sma11black/[email protected].3 | ||
uses: alterhu2020/hexo-gulp-[email protected].0 | ||
with: | ||
deploy_key: ${{ secrets.DEPLOY_KEY }} | ||
user_name: your github username # (or delete this input setting to use bot account) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters