fix: remove unnecessary parts #20
This file contains hidden or 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 Frontend | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| jobs: | |
| build_and_deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Prepare deployment directory | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.HOSTINGER_HOST }} | |
| username: ${{ secrets.HOSTINGER_USER }} | |
| key: ${{ secrets.HOSTINGER_SSH_KEY }} | |
| port: 22 | |
| script: | | |
| mkdir -p /var/www/sramap/frontend | |
| rm -rf /var/www/sramap/frontend/* | |
| - name: Deploy to server | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.HOSTINGER_HOST }} | |
| username: ${{ secrets.HOSTINGER_USER }} | |
| key: ${{ secrets.HOSTINGER_SSH_KEY }} | |
| port: 22 | |
| source: ".next,public,package.json,package-lock.json" | |
| target: /var/www/sramap/frontend | |
| strip_components: 0 | |
| - name: Install and restart frontend | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.HOSTINGER_HOST }} | |
| username: ${{ secrets.HOSTINGER_USER }} | |
| key: ${{ secrets.HOSTINGER_SSH_KEY }} | |
| port: 22 | |
| script: | | |
| export PATH="/home/sramap/.nvm/versions/node/v24.13.0/bin:$PATH" | |
| cd /var/www/sramap/frontend | |
| npm ci | |
| sudo systemctl restart sramap-frontend | |
| sudo systemctl restart sramap-backend | |
| sleep 3 | |
| curl -f http://localhost:3002 || echo "Health check pending..." |