Tutorials ASP.NET Core Complete Tutorial (ShopNest)

CI/CD with GitHub Actions for ASP.NET Core

Learn CI/CD with GitHub Actions for ASP.NET Core in our free ASP.NET Core Complete Tutorial (ShopNest) series. Step-by-step explanations, examples, and interview tips on Toolliyo Academy.

On this page
CI/CD with GitHub Actions for ASP.NET Core — ShopNest
Article 62 of 75 · Module 8: Deployment & DevOps · ShopNest Automated Deployment Pipeline
Target keyword: github actions asp.net core · Read time: ~32 min · .NET: 8 / 9 · Project: ShopNest Automated Deployment Pipeline

Introduction

Every ShopNest push to main should build, test, and deploy automatically — GitHub Actions YAML pipelines replace manual FTP uploads.

After this article you will

  • Write build-test-deploy workflow YAML
  • Run dotnet test in CI with coverage
  • Deploy to Azure App Service on success
  • Store secrets in GitHub Secrets
  • Require PR checks before merge

Prerequisites

Concept deep-dive

# .github/workflows/shopnest-ci.yml
name: ShopNest CI/CD
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.0.x'
      - run: dotnet restore ShopNest.sln
      - run: dotnet build ShopNest.sln -c Release --no-restore
      - run: dotnet test ShopNest.sln -c Release --no-build --verbosity normal
      - run: dotnet publish ShopNest.Web/ShopNest.Web.csproj -c Release -o ./publish
      - uses: azure/webapps-deploy@v3
        if: github.ref == 'refs/heads/main'
        with:
          app-name: shopnest-prod
          publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}

Branch strategy: feature/* → PR → develop → main. PR workflow runs tests only; main deploys.

Hands-on — ShopNest Automated Deployment Pipeline

  1. Add workflow file; push to trigger.
  2. Store AZURE_PUBLISH_PROFILE in GitHub Secrets.
  3. Add branch protection: require build pass.
  4. Optional: Codecov upload from test step.
  5. Slack/email notify on failure.

Common errors & best practices

  • Secrets in YAML — use ${{ secrets.NAME }} only.
  • Deploy on PR — gate deploy with if: github.ref == 'refs/heads/main'.
  • Missing EF tools for migration step — add dotnet-ef tool install.

Interview questions

Q: CI vs CD?
A: CI builds/tests; CD deploys artifact to environment.

Q: Where store Azure creds?
A: GitHub Secrets or OIDC federated credentials to Azure.

Summary

  • YAML pipeline: restore → build → test → publish → deploy
  • PR checks catch breaks before merge
  • Secrets never in repository
  • Publish profile or OIDC for Azure deploy

Previous: Azure App Service
Next: Azure SQL Database

FAQ

Azure DevOps instead?

Similar YAML; GitHub Actions native if code on GitHub.

Run migrations in CI?

Separate job with production connection secret — use carefully.

Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

ASP.NET Core Complete Tutorial (ShopNest)
Course syllabus
Module 1: Foundations
Module 2: Entity Framework Core
Module 3: Dependency Injection & Middleware
Module 4: Authentication & Security
Module 5: Web API
Module 6: Advanced Architecture
Module 7: Testing
Module 8: Deployment & DevOps
Module 9: Real-World Projects
Module 10: Advanced Topics
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details