test cicd #22
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 Movie App Client | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create .env file | |
run: | | |
echo "REACT_APP_API_SERVICE_URL=http://[email protected]:5000/api/v1" > .env | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
run: | | |
docker build -t minhquang31122000/movies-app-fe:latest . | |
docker push minhquang31122000/movies-app-fe:latest | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: 18.179.5.154 | |
username: ubuntu | |
key: ${{ secrets.EC2_KEY }} | |
port: 22 | |
script: | | |
cd projects/movies-app/client/ | |
./deploy.sh | |