mirror of
https://github.com/Powerful-517/yys-editor.git
synced 2025-08-23 08:04:50 +00:00
Create deploy_dev.yml
This commit is contained in:
48
.github/workflows/deploy_dev.yml
vendored
Normal file
48
.github/workflows/deploy_dev.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Deploy to Development
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install dependencies and build
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Deploy to temporary directory
|
||||
uses: appleboy/scp-action@v0.1.6
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USERNAME }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
port: ${{ secrets.SERVER_PORT || 22 }}
|
||||
source: "dist/"
|
||||
target: "~/code/yys-editor-dev"
|
||||
strip_components: 1
|
||||
rm: true
|
||||
|
||||
- name: Copy to development directory
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USERNAME }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
port: ${{ secrets.SERVER_PORT || 22 }}
|
||||
script: |
|
||||
# 清空目标目录
|
||||
sudo rm -rf /var/www/html/yys-editor-dev
|
||||
# 复制文件到目标目录
|
||||
sudo cp -rf /home/ubuntu/code/yys-editor-dev /var/www/html/
|
Reference in New Issue
Block a user