Update README.md #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 Vite App | |
on: | |
push: | |
branches: | |
- main # Триггер срабатывает при пуше в ветку main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Vite App | |
run: npm run build | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -H 37.140.195.97 >> ~/.ssh/known_hosts | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy to VPS | |
run: | | |
ssh [email protected] "rm -rf /var/www/html/imp/dist" | |
scp -r ./dist [email protected]:/var/www/html/imp | |
ssh [email protected] "sudo systemctl restart nginx" |