From 902abe1f3ad9aa557d2bab84847b0edc01e1cbc7 Mon Sep 17 00:00:00 2001 From: mozzie Date: Tue, 4 Jun 2024 13:59:56 +0800 Subject: [PATCH] 1 --- .drone.yml | 10 +++++++++ .gitea/workflows/build.yml | 40 --------------------------------- ci.js | 46 -------------------------------------- 3 files changed, 10 insertions(+), 86 deletions(-) create mode 100644 .drone.yml delete mode 100644 .gitea/workflows/build.yml delete mode 100644 ci.js diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..0da7e8d3 --- /dev/null +++ b/.drone.yml @@ -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! \ No newline at end of file diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml deleted file mode 100644 index b1ec581d..00000000 --- a/.gitea/workflows/build.yml +++ /dev/null @@ -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 }} \ No newline at end of file diff --git a/ci.js b/ci.js deleted file mode 100644 index 9a0fc3a6..00000000 --- a/ci.js +++ /dev/null @@ -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}`); -// } -// })(); \ No newline at end of file