Skip to content

install scp

install scp #11

Workflow file for this run

name: Deploy VitePress site to Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
# 构建工作
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9.11.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: pnpm install
- name: Build with VitePress
run: |
pnpm run build
echo ${{ secrets.SSH_KEY }} > /tmp/test.pem
sudo apt-get install openssh-client -y
scp -i /tmp/test.pem -P ${{ secrets.SERVER_PORT }} -r .vitepress/dist/ ${{ secrets.SSH_USER }}@${{ secrets.SERVER_HOST }}:/opt/www/doc-v3/
if [ $? -ne 0 ]; then
echo "Upload failed"
exit 1
fi
echo "Upload successful"