Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rain1024 committed Oct 23, 2024
1 parent 586c854 commit 17fbd25
Showing 1 changed file with 41 additions and 34 deletions.
75 changes: 41 additions & 34 deletions .github/workflows/deploy-languages-v2-web.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Deploy Languages V2 Web
on:
pull_request:
branches: [ main ]
types:
- labeled
- synchronize
pull_request:
branches: [main]
types:
- labeled
- synchronize

jobs:
build-and-deploy:
name: Build and Deploy
Expand All @@ -14,32 +15,38 @@ jobs:
PROJECT_PATH: apps/languagesv2/languages-v2-web
TARGET_PATH: /root/apps
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
working-directory: ${{ env.PROJECT_PATH }}
run: npm install
- name: Build React App
working-directory: ${{ env.PROJECT_PATH }}
run: npm run build
- name: Clean target folder on remote server
run: |
sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }} "
rm -rf ${{ env.TARGET_PATH }}/*"
- name: Copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.UTS_HOST }}
username: ${{ secrets.UTS_USERNAME }}
password: ${{ secrets.UTS_PASSWORD }}
port: ${{ secrets.UTS_PORT }}
source: "${{ env.PROJECT_PATH }}/build/*"
target: "${{ env.TARGET_PATH }}"
recursive: true
- name: Move build files to target folder on remote server
run: |
sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }}
"mv ${{ env.TARGET_PATH }}/${{ env.PROJECT_PATH }}/build/* ${{ env.TARGET_PATH }}/ && rm -rf ${{ env.TARGET_PATH }}/apps"
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
working-directory: ${{ env.PROJECT_PATH }}
run: npm install

- name: Build React App
working-directory: ${{ env.PROJECT_PATH }}
run: npm run build

- name: Clean target folder on remote server
run: |
sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }} \
"rm -rf ${{ env.TARGET_PATH }}/*"
- name: Copy build files via SCP
uses: appleboy/[email protected]
with:
host: ${{ secrets.UTS_HOST }}
username: ${{ secrets.UTS_USERNAME }}
password: ${{ secrets.UTS_PASSWORD }}
port: ${{ secrets.UTS_PORT }}
source: "${{ env.PROJECT_PATH }}/build/*"
target: "${{ env.TARGET_PATH }}"
recursive: true

- name: Move build files on the remote server
run: |
sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }} \
"mv ${{ env.TARGET_PATH }}/* ${{ env.TARGET_PATH }}/ && rm -rf ${{ env.TARGET_PATH }}/apps"

0 comments on commit 17fbd25

Please sign in to comment.