From d2a5f69784227be24a4cf38d95b4fc84881f1c74 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Tue, 13 Aug 2024 19:51:54 -0700 Subject: [PATCH] Tag and Push frontend dashboard image only on Push event Workflow dispatch event is triggered on changes to server image. This should build the notebook server image as it uses the server image. But frontend is Javascript nodejs based image and is unrelated to the server. Check this review comment: https://github.com/e-mission/em-public-dashboard/pull/125#discussion_r1714430059 --- .github/workflows/image_build_push.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image_build_push.yml b/.github/workflows/image_build_push.yml index bb1267c..120b8eb 100644 --- a/.github/workflows/image_build_push.yml +++ b/.github/workflows/image_build_push.yml @@ -105,8 +105,8 @@ jobs: echo "Workflow_dispatch: New server image built and pushed, Updating image tag in .env" echo "SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_WORKFLOW_DISPATCH" > .env # else - # echo "Push event: Restoring latest server image tag in .env" - # echo "SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_PUSH" > .env + echo "Push event: Restoring latest server image tag in .env" + # echo "SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_PUSH" > .env fi - name: Add, Commit, Push changes to .env file @@ -143,12 +143,16 @@ jobs: - name: rename docker images run: | - docker image tag em-pub-dash-dev/frontend:latest $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} + if [ "${{ github.event_name }}" == "push" ]; then + docker image tag em-pub-dash-dev/frontend:latest $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} + fi docker image tag em-pub-dash-dev/viz-scripts:latest $DOCKER_USER/${GITHUB_REPOSITORY#*/}_notebook:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} - name: push docker images run: | - docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} + if [ "${{ github.event_name }}" == "push" ]; then + docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} + fi docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}_notebook:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} - name: Create a text file