This commit is contained in:
parent
13cfa0c8a0
commit
902abe1f3a
10
.drone.yml
Normal file
10
.drone.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: exec
|
||||
name: blog 发布
|
||||
|
||||
steps:
|
||||
- name: publish
|
||||
commands:
|
||||
- cp -rf public/* /www/wwwroot/caddy/html/blog-hexo/
|
||||
- echo all works done!
|
|
@ -1,40 +0,0 @@
|
|||
name: Build Project
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '18' # or specify the version you need
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm i -g pnpm hexo
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: hexo clean
|
||||
run: hexo cl
|
||||
|
||||
- name: hexo generate
|
||||
run: hexo g
|
||||
|
||||
- name: build algolia search index
|
||||
run: pnpm run search
|
||||
|
||||
- name: Scp files to remote server
|
||||
run: |
|
||||
scp -r public/* root@maxshader.com:/www/wwwroot/caddy/html/blog-hexo
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
46
ci.js
46
ci.js
|
@ -1,46 +0,0 @@
|
|||
const { exec } = require('child_process')
|
||||
|
||||
const executeCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`Error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await executeCommand('hexo cl');
|
||||
await executeCommand('hexo g');
|
||||
await executeCommand('pnpm run search');
|
||||
await executeCommand('git add .');
|
||||
await executeCommand(`git commit -m 'update'`);
|
||||
await executeCommand(`git push`);
|
||||
} catch (error) {
|
||||
console.error(`Execution failed: ${error}`);
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
|
||||
// const execa = require('execa');
|
||||
|
||||
// (async () => {
|
||||
// try {
|
||||
// await execa('hexo', ['cl']);
|
||||
// await execa('hexo', ['g']);
|
||||
// await execa('pnpm', ['run', 'search']);
|
||||
// await execa('git', ['add', '.']);
|
||||
// console.log('All commands executed successfully.');
|
||||
// } catch (error) {
|
||||
// console.error(`Execution failed: ${error.message}`);
|
||||
// }
|
||||
// })();
|
Loading…
Reference in New Issue
Block a user