ci: fix error please #4
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 React App to Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🎯 Checkout Code | |
uses: actions/checkout@v2 | |
- name: 🧩 Set up Node.js 20.12.2 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.12.2' | |
- name: 🛠️ Install Dependencies and Build Project | |
run: | | |
npm install | |
npm run build | |
- name: 🔑 Set up SSH Agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: 📂 Create Directory on Server | |
run: | | |
ssh -o StrictHostKeyChecking=no jiho99322@${{ secrets.SERVER_IP }} "mkdir -p /var/www/html/dist" | |
- name: 📤 Copy Files to Server | |
run: | | |
ssh -o StrictHostKeyChecking=no jiho99322@${{ secrets.SERVER_IP }} "scp -r dist/* jiho99322@${{ secrets.SERVER_IP }}:/tmp/" | |
- name: ⚙️ Move Files to Target Directory and Set Permissions | |
run: | | |
ssh -o StrictHostKeyChecking=no jiho99322@${{ secrets.SERVER_IP }} "sudo mv /tmp/* /var/www/html/dist/ && sudo chmod -R 755 /var/www/html/dist" | |
- name: 🔄 Restart Nginx on Server | |
run: | | |
ssh -o StrictHostKeyChecking=no jiho99322@${{ secrets.SERVER_IP }} "sudo systemctl restart nginx" |