Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
raghav2404 authored Dec 14, 2024
1 parent f0f917f commit 6960b01
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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
- name: Checkout code
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 }}
Expand All @@ -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

0 comments on commit 6960b01

Please sign in to comment.