This commit is contained in:
186526 2021-04-20 17:55:14 +08:00
parent 24367743a9
commit e492ca4733
Signed by untrusted user: 186526
GPG Key ID: C7EB1E6B8CC5E51D
6 changed files with 56 additions and 2 deletions

24
.drone.yml Normal file
View File

@ -0,0 +1,24 @@
kind: pipeline
type: docker
name: build-dist
steps:
- name: build
image: node:lts-buster
commands:
- apt-get update -y && apt-get install git -y
- yarn install
- yarn drone-build
- name: git-push
image: appleboy/drone-git-push
settings:
ssh_key:
from_secret: ssh_key
remote:
remote_name: git
branch: master
commit: true
author_name: Drone CI
author_email: droneci@186526.xyz
commit_message: "[Drone CI] Build Dist"

View File

@ -8,7 +8,8 @@
"deploy": "hexo deploy",
"server": "hexo server",
"build-cloudflare": "yarn;yarn --cwd ./themes/suka;hexo generate;node cleancache.js",
"vercel-build": "yarn build-cloudflare"
"vercel-build": "yarn build-cloudflare",
"drone-build": "yarn;yarn --cwd ./themes/suka;hexo generate"
},
"hexo": {
"version": "5.3.0"

View File

@ -2,7 +2,9 @@
<p class="footer-develop">
<img alt="Keybase PGP" src="https://img-shields-io.186526.xyz/keybase/pgp/186526">
<img alt="Update Commit" src="https://img-shields-io.186526.xyz/badge/commit-<%= globalThis.commitID %> -blue">
<img alt="Latest Update" src="https://img-shields-io.186526.xyz/date/<%= globalThis.commitTime %>?color=sucessful&label=latest%20update">
<a href="https://git.186526.xyz/186526/blog.186526.xyz"><img alt="Latest Update" src="https://img-shields-io.186526.xyz/date/<%= globalThis.commitTime %>?color=sucessful&label=latest%20update"></a>
<a href="https://drone.186526.xyz/186526/blog.186526.xyz"><img src="https://drone.186526.xyz/api/badges/186526/blog.186526.xyz/status.svg" /></a>
<img alt="Build environment" src="https://img-shields-io.186526.xyz/badge/build environment-<%= globalThis.buildEnvironment %>-blue">
</p>
<p class="footer-develop">
<img alt="Chromium HSTS preload" src="https://img-shields-io.186526.xyz/hsts/preload/186526.xyz">

View File

@ -36,6 +36,7 @@
"dependencies": {
"autoprefixer": "^10.2.5",
"cssnano": "^4.1.10",
"getos": "^3.2.1",
"node-prismjs": "0.1.2",
"postcss": "^8.2.8",
"postcss-css-variables": "^0.17.0",

View File

@ -21,6 +21,7 @@ require('../includes/generator/search')(hexo);
// Filter
require('../includes/filter/prism')(hexo);
const getos = require('getos');
const { exec } = require('child_process');
globalThis.exec = exec;
exec('git rev-parse --short HEAD', (err, stdout, stderr) => {
@ -30,7 +31,20 @@ exec('git rev-parse --short HEAD', (err, stdout, stderr) => {
exec('git log --pretty=format:"%ct" HEAD -1',(err,stdout, stderr)=>{
globalThis.commitTime = stdout;
console.log(`CommitTime: ${stdout}`);
})
getos((e,os)=>{
if(e) throw new Error(e);
if(os.os === "linux"){
if(os.release == undefined){
globalThis.buildEnvironment = `${os.dist} @ Node.js ${process.version}`
}else{
globalThis.buildEnvironment = `${os.dist} ${os.release} @ Node.js ${process.version}`
}
}else{
globalThis.buildEnvironment = `${os.os} @ Node.js ${process.version}`;
}
console.log(`Running in ${globalThis.buildEnvironment}`);
})
// Debug helper

View File

@ -297,6 +297,11 @@ async-settle@^1.0.0:
dependencies:
async-done "^1.2.2"
async@^3.2.0:
version "3.2.0"
resolved "https://registry.npmjs.org/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==
atob@^2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
@ -1785,6 +1790,13 @@ get-value@^2.0.3, get-value@^2.0.6:
resolved "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=
getos@^3.2.1:
version "3.2.1"
resolved "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz#0134d1f4e00eb46144c5a9c0ac4dc087cbb27dc5"
integrity sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==
dependencies:
async "^3.2.0"
glob-parent@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"