Deploy Docs to VPS #18
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
name: Deploy Docs to VPS | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- '*/*.md' | |
- '.docs/**/*' | |
workflow_dispatch: | |
inputs: | |
message: | |
description: 'Test scenario tags' | |
workflow_run: | |
workflows: ["Update Workflow Version"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
node-version: [ 18 ] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-modules | |
- name: Install Dependencies | |
run: | | |
npm install | |
- name: Build | |
run: | | |
npm run docs:initmd | |
npm run docs:build | |
- name: SSH agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.BLOG_DEPLOY_KEY }} | |
- name: Deploy VPS | |
run: | | |
ssh-keyscan 1991421.cn >> ~/.ssh/known_hosts | |
rsync -az -vv --delete -e 'ssh -p ${{ secrets.BLOG_DEPLOY_PORT }}' .docs/.vitepress/dist [email protected]:/var/www/alfred | |
- name: Notify | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
Alfred Docs update completed, see here(https://alfred.1991421.cn). | |
See code(https://github.com/${{github.repository}}) | |
format: markdown |