Skip to content

Commit

Permalink
feat: 初步完成
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Feb 21, 2022
0 parents commit 6e67f73
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '36 21 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
50 changes: 50 additions & 0 deletions .github/workflows/npm-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: npm Push

on:
push:
tags:
- 'v*'

jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v2

# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-npm-and-github-packages

# Setup .npmrc file to publish to npm
- name: Setup Node.js and Setup .npmrc file to publish to npm
uses: actions/setup-node@v2
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'

# - name: Build
# run: |
# npm install
# npm run build:prod
# npm run build:cdn

- name: Publish to npm
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Setup .npmrc file to publish to GitHub Packages
- name: Setup Node.js and Setup .npmrc file to publish to GitHub Packages
uses: actions/setup-node@v2
with:
node-version: 12
registry-url: 'https://npm.pkg.github.com'

- name: Publish to GitHub Package
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}



43 changes: 43 additions & 0 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: npm Release

on:
push:
tags:
- 'v*'

jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12

# - name: Build
# run: |
# npm install
# npm run build:prod
# npm run build:cdn

# - name: Zip the Build
# run: |
# zip -r dist.zip ./dist/
# zip -r dist-cdn.zip ./dist-cdn/

- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
#tag_name: ${{ github.ref }}
#name: ${{ github.ref }}
body: TODO New Release.
#body_path: CHANGELOG.txt
draft: false
prerelease: false
files: |
index.js
LICENSE
20 changes: 20 additions & 0 deletions .github/workflows/sync-gitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync to Gitee

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Sync to Gitee
uses: wearerequired/git-mirror-action@master
env:
# 在 Settings->Secrets 配置 GITEE_SSH_PRIVATE_KEY
SSH_PRIVATE_KEY: ${{ secrets.GITEE_SSH_PRIVATE_KEY }}
with:
# GitHub 源仓库地址
source-repo: [email protected]:yiyungent/hexo-cloud.git
# Gitee 目标仓库地址
destination-repo: [email protected]:yiyungent/hexo-cloud.git
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-present yiyun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added README.md
Binary file not shown.
Binary file added README_zh.md
Binary file not shown.
7 changes: 7 additions & 0 deletions default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# hexo-cloud
# For more information: https://github.com/yiyungent/hexo-cloud
hexocloud:
enable: true
serverURL: https://api-onetree.moeci.com # Server address url
plugincoreVersion: latest #
plugincoreLibURL: https://unpkg.com/@yiyungent/plugincore/dist/PluginCore.min.js
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const utils = new Util(hexo, __dirname);

hexo.extend.injector.register(
"body_end",
() => {
let rtnStr = "";
const config = utils.defaultConfigFile('hexo-cloud', 'default.yaml');
if (!config.enable || !config.serverURL) return rtnStr;

let plugincoreVersion = config.plugincoreVersion;
rtnStr += `<!-- PluginCore.IPlugins.IWidgetPlugin.Widget(hexo-cloud,${plugincoreVersion},body_end) -->
<script src="${config.plugincoreLibURL}"></script>
<script>
document.addEventListener('page:loaded', () => {
var hexoPluginCore = new PluginCore({
baseUrl: "${config.serverURL}"
});
hexoPluginCore.start();
});
</script>`;

return rtnStr;
},
"default"
);
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "hexo-cloud",
"version": "0.1.0",
"description": "Hexo 云插件 | 云服务",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/yiyungent/hexo-cloud.git"
},
"keywords": [
"hexo",
"hexo-cloud"
],
"author": "yiyun",
"license": "MIT",
"bugs": {
"url": "https://github.com/yiyungent/hexo-cloud/issues"
},
"homepage": "https://github.com/yiyungent/hexo-cloud#readme"
}

0 comments on commit 6e67f73

Please sign in to comment.