chore(deps): update copy-webpack-plugin and related packages #2
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 to Server | |
on: | |
push: | |
branches: [ proxy ] | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: proxy | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.16.0" | |
- name: Install dependencies | |
run: yarn | |
- name: Build project | |
run: yarn build | |
- name: Clear destination directory | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
rm -rf /root/163music-proxy | |
mkdir -p /root/163music-proxy | |
- name: Deploy dist files | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: "dist/*" | |
target: "/root/163music-proxy" | |
strip_components: 1 | |
- name: Deploy package.json | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: "package.json" | |
target: "/root/163music-proxy" | |
- name: Deploy node_modules | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: "node_modules" | |
target: "/root/163music-proxy" | |
- name: Deploy ecosystem.config.js | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
source: "ecosystem.config.js" | |
target: "/root/163music-proxy" | |
- name: Start PM2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
cd /root/163music-proxy | |
pm2 stop 163music-proxy | |
pm2 delete 163music-proxy | |
npm run pm2 |