diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 59ed11d..e0b8b23 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -15,7 +15,7 @@ jobs: env: DOTNET_VERSION: 8.0 PUBLISH_DIR: ./publish - CONNECTION_STRING: ${{ secrets.SQL_CONNECTION_STRING }} # Add this to GitHub Secrets + IMAGE_NAME: ragh2404/demoMvcCore # Docker image name steps: # Step 1: Check out code @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v3 # Step 2: Set up .NET - - name: Setup .NET Core SDK + - name: Setup .NET SDK uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} @@ -36,12 +36,21 @@ jobs: - name: Build the solution run: dotnet build --configuration Release - # Step 5: Run tests (optional) - - name: Run tests - run: dotnet test --no-build --verbosity normal + # Step 6: Build Docker Image + - name: Build Docker Image + run: | + docker build -t ${{ env.IMAGE_NAME }}:latest . - # Step 6: Publish the application - - name: Publish application - run: dotnet publish --configuration Release --output ${{ env.PUBLISH_DIR }} + # Step 7: Log in to DockerHub (or your preferred registry) + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: raghav2404l + password: Rr24042000#Rr + + # Step 8: Push Docker image to DockerHub + - name: Push Docker Image to Docker Hub + run: | + docker push ${{ env.IMAGE_NAME }}:latest - +