From 144ed495aeacdd4d8f3975fe7f1420fc12ceb2a1 Mon Sep 17 00:00:00 2001 From: Danish Joseph Date: Tue, 16 Jul 2024 07:32:53 +0200 Subject: [PATCH] fix: docker image publish to dockerhub (#40) --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 961d7ed..852cd68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,8 @@ jobs: name: Build Docker image needs: test runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} steps: - uses: actions/checkout@v4 @@ -52,12 +54,12 @@ jobs: - name: Get version number id: version - run: echo "VERSION=$(cat ./package.json | jq -r '.version')" >> $GITHUB_ENV + run: echo "version=$(cat ./package.json | jq -r '.version')" >> $GITHUB_OUTPUT - name: Build Docker image run: | - yarn nx run backend:docker-build --tag=${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ env.VERSION }} - docker save ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ env.VERSION }} > docker_image.tar + yarn nx run backend:docker-build --tag=${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ steps.version.outputs.version }} + docker save ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ steps.version.outputs.version }} > docker_image.tar - name: Upload Docker image as artifact uses: actions/upload-artifact@v3 @@ -85,4 +87,4 @@ jobs: password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Push Docker image - run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ env.VERSION }} + run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/stockdog:v-${{ needs.build.outputs.version }}