From acbd3128008325b50101d0614e9f7e91ece670f1 Mon Sep 17 00:00:00 2001 From: Abhishek Thakur Date: Wed, 24 Apr 2024 17:02:03 +0200 Subject: [PATCH] split workflows --- .github/workflows/docker.yml | 26 ++++++++++++++++ .../workflows/{build_and_push.yml => ecr.yml} | 31 ++++--------------- .../{build_and_push_ngc.yml => ngc.yml} | 0 3 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/docker.yml rename .github/workflows/{build_and_push.yml => ecr.yml} (64%) rename .github/workflows/{build_and_push_ngc.yml => ngc.yml} (100%) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..8b61d43778 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,26 @@ +name: Docker Hub + +on: + push: + branches: + - main + +jobs: + dockerhub: + name: Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and Push Docker Image + run: make docker diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/ecr.yml similarity index 64% rename from .github/workflows/build_and_push.yml rename to .github/workflows/ecr.yml index 8227e8a082..9cf5dfcb66 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/ecr.yml @@ -1,38 +1,19 @@ -name: Docker Hub & Amazon ECR +name: Amazon ECR on: - push: - branches: - - main + workflow_run: + workflows: ["Docker Hub"] + types: + - completed env: AWS_REGION: us-east-1 ECR_REPOSITORY: public.ecr.aws/z4c3o6n6 - CONTAINER_NAME: autotrain-api + CONTAINER_NAME: autotrain-api jobs: - dockerhub: - name: Docker Hub - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Build and Push Docker Image - run: make docker - ecr: name: Amazon ECR - needs: dockerhub runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/build_and_push_ngc.yml b/.github/workflows/ngc.yml similarity index 100% rename from .github/workflows/build_and_push_ngc.yml rename to .github/workflows/ngc.yml