Skip to content

try gh-pages

try gh-pages #36

Workflow file for this run

name: AutoNav_CI
on:
push:
branches: [ "autonav_web" ]
workflow_dispatch:
jobs:
CI_Pipeline:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v5.3.0
with:
context: .
file: react.Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/autonav:react
CD_Pipeline:
name: Pull Docker image to EC2 and Run
runs-on: ubuntu-latest
needs: CI_Pipeline
steps:
- name: Deploy to EC2 instance
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script: |
docker stop react || true
docker rm react || true
docker pull ${{ secrets.DOCKER_USERNAME }}/autonav:react
docker run -d --name react -p 80:80 ${{ secrets.DOCKER_USERNAME }}/autonav:react