Merge pull request #43 from deerhack/dev #13
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 to Remote Server | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| name: Deploy to Remote Server | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Dependencies | |
| working-directory: frontend | |
| run: | | |
| npm install | |
| - name: Build Frontend | |
| working-directory: frontend | |
| run: | | |
| npm run deploy | |
| - name: Transfer files to Remote Server | |
| uses: easingthemes/ssh-deploy@main | |
| with: | |
| SOURCE: frontend/.next/standalone/ | |
| SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }} | |
| REMOTE_HOST: ${{ secrets.HOST_DNS }} | |
| REMOTE_USER: ${{ secrets.USERNAME }} | |
| # EXCLUDE: "/node_modules/" | |
| TARGET: /home/ubuntu/code/ | |
| - name: SSH into Remote Server and Start Application | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST_DNS }} | |
| username: ${{ secrets.USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| PRODUCTION=1 pm2 reload all --update-env |