Update main.yml #10
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: Adiozdev Portfolio Redeployment | |
| on: push | |
| jobs: | |
| deploy: | |
| name: Push to EC2 Instance | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run build task | |
| run: npm run build | |
| - name: Deploy to EC2 instance | |
| uses: easingthemes/ssh-deploy@main | |
| env: | |
| SSH_PRIVATE_KEY: ${{ secrets.ADIOZDEV_SSH_PRIVATE_KEY}} | |
| REMOTE_HOST: "ec2-16-78-223-232.ap-southeast-3.compute.amazonaws.com" | |
| REMOTE_USER: "ec2-user" | |
| SOURCE: "dist/" | |
| TARGET: "/home/ec2-user/adiozdev/dist" | |
| SCRIPT_AFTER: | | |
| sudo service nginx reload || echo "nginx reload failed" | |
| SCRIPT_AFTER_REQUIRED: true |