Skip to content

Merge pull request #472 from haoxiuwen/doc-v2 #505

Merge pull request #472 from haoxiuwen/doc-v2

Merge pull request #472 from haoxiuwen/doc-v2 #505

Workflow file for this run

name: note build
# 触发workflow的条件
on:
push:
branches: ["doc-v2"]
env:
SERVER_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }} # 服务器私钥
SERVER_HOST: ${{ secrets.SERVER_HOST }} # 服务器IP地址
SERVER_POSR: ${{ secrets.SERVER_PORT }} # 服务器端口
USER_NAME: ${{ secrets.SERVER_USER_NAME }} # 服务器用户名
cache-name: note
TZ: Asia/Shanghai # 设置当前环境时区
# jobs表示执行的一项或多项任务
jobs:
cache-and-install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm docs:build
# 上传打包资源
- name: Deploy
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "docs/.vuepress/dist/"
REMOTE_HOST: ${{ secrets.SERVER_HOST }}
REMOTE_PORT: ${{ secrets.SERVER_PORT }} -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa
REMOTE_USER: ${{ secrets.SERVER_USER_NAME }}
TARGET: /data/apps/data/docs-im-beta/ # 服务器目标路径
- name: CDN Refresh
uses: visionwx/ali-cdn-refresh@main
with:
accessKeyId: ${{ secrets.ALIYUN_CDN_ACCESS_KEY_ID }}
accessKeySecret: ${{ secrets.ALIYUN_CDN_ACCESS_KEY_SECRET }}
type: Directory
path: https://docs-im-beta.easemob.com/\r\nhttp://docs-im-beta.easemob.com/