diff --git a/.github/workflows/starter-no-infra_dev-4u4qhiztjanba.yml b/.github/workflows/starter-no-infra_dev-4u4qhiztjanba.yml index 46bcc7dd..10863ab8 100644 --- a/.github/workflows/starter-no-infra_dev-4u4qhiztjanba.yml +++ b/.github/workflows/starter-no-infra_dev-4u4qhiztjanba.yml @@ -27,6 +27,12 @@ jobs: - name: dotnet publish run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp + - name: nstall dotnet ef + run: dotnet tool install -g dotnet-ef --version 8.* + + - name: Create migration bundle + run: dotnet ef migrations bundle --runtime linux-x64 -o ${{env.DOTNET_ROOT}}/myapp/migrationsbundle + - name: Upload artifact for deployment job uses: actions/upload-artifact@v4 with: @@ -39,21 +45,21 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - permissions: - id-token: write #This is required for requesting the JWT + permissions: + id-token: write #This is required for requesting the JWT steps: - name: Download artifact from build job uses: actions/download-artifact@v4 with: name: .net-app - - - name: Login to Azure - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_319DDE8D9F4B4C74A9AB966B051D210E }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_AF081E3B8DC54CBAB41CE97FFE6A6307 }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_01AC867E738A4C3DBBC0E2E51A4BF863 }} + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_319DDE8D9F4B4C74A9AB966B051D210E }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_AF081E3B8DC54CBAB41CE97FFE6A6307 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_01AC867E738A4C3DBBC0E2E51A4BF863 }} - name: Deploy to Azure Web App id: deploy-to-webapp diff --git a/Program.cs b/Program.cs index ffa36572..eb38ee15 100644 --- a/Program.cs +++ b/Program.cs @@ -9,16 +9,16 @@ options.UseSqlServer(builder.Configuration.GetConnectionString("MyDbConnection"))); builder.Services.AddDistributedMemoryCache(); } -// else -// { -// builder.Services.AddDbContext(options => -// options.UseSqlServer(builder.Configuration.GetConnectionString("AZURE_SQL_CONNECTIONSTRING"))); -// builder.Services.AddStackExchangeRedisCache(options => -// { -// options.Configuration = builder.Configuration["AZURE_REDIS_CONNECTIONSTRING"]; -// options.InstanceName = "SampleInstance"; -// }); -// } +else +{ + builder.Services.AddDbContext(options => + options.UseSqlServer(builder.Configuration.GetConnectionString("AZURE_SQL_CONNECTIONSTRING"))); + builder.Services.AddStackExchangeRedisCache(options => + { + options.Configuration = builder.Configuration["AZURE_REDIS_CONNECTIONSTRING"]; + options.InstanceName = "SampleInstance"; + }); +} // Add services to the container. builder.Services.AddControllersWithViews();