Merge branch 'supuni-dev' of https://github.com/BlissMe/frontend into… #16
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 Blissme Frontend | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - supuni-dev | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
| - name: Build and push Docker image | |
| run: | | |
| docker build -t your-dockerhub-username/blissme-frontend:latest . | |
| docker push your-dockerhub-username/blissme-frontend:latest | |
| - name: Set up SSH key | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| - name: Connect to EC2 and deploy container | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| docker pull your-dockerhub-username/blissme-frontend:latest | |
| docker stop blissme-frontend || true | |
| docker rm blissme-frontend || true | |
| docker run -d -p 80:80 --name blissme-frontend your-dockerhub-username/blissme-frontend:latest | |
| echo "✅ Frontend deployed successfully!" |