Skip to content

Commit 6d7e464

Browse files
committed
Enhance CI workflow with Docker build and push steps; update error message heading from h4 to h2 for better visibility
1 parent 4cc5e82 commit 6d7e464

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

.github/workflows/dotnet-deploy-1.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
name: .NET CI
22

3+
env:
4+
registryName: mpplabajep.azurecr.io
5+
repositoryName: techexcel/dotnetcoreapp
6+
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
7+
tag: ${{github.run_number}}
8+
39
on:
410
push:
511
branches: [ main ]
6-
paths:
7-
- src/Application/**
12+
paths: src/Application/**
813
pull_request:
914
branches: [ main ]
10-
paths:
11-
- src/Application/**
15+
paths: src/Application/**
1216
# Allows you to run this workflow manually from the Actions tab
1317
workflow_dispatch:
1418
jobs:
@@ -21,11 +25,39 @@ jobs:
2125
- name: Setup .NET
2226
uses: actions/setup-dotnet@v3
2327
with:
24-
dotnet-version: '8.0.x'
25-
28+
dotnet-version: 8.0
29+
2630
- name: Restore dependencies
2731
run: dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
2832
- name: Build
2933
run: dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
3034
- name: Test
31-
run: dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
35+
run: dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
36+
37+
dockerBuildPush:
38+
39+
runs-on: ubuntu-latest
40+
needs: build
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Docker Login
46+
# You may pin to the exact commit or the version.
47+
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
48+
uses: docker/[email protected]
49+
with:
50+
# Server address of Docker registry. If not set then will default to Docker Hub
51+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
52+
# Username used to log against the Docker registry
53+
username: ${{ secrets.ACR_USERNAME }}
54+
# Password or personal access token used to log against the Docker registry
55+
password: ${{ secrets.ACR_PASSWORD }}
56+
# Log out from the Docker registry at the end of a job
57+
logout: true
58+
59+
- name: Docker Build
60+
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
61+
62+
- name: Docker Push
63+
run: docker push $registryName/$repositoryName:$tag

src/Application/src/RazorPagesTestSample/Pages/Error.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
}
66

77
<h1 class="text-danger">Error.</h1>
8-
<h4 class="text-danger">An error occurred while processing your request.</h4>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
99

1010
@if (Model.ShowRequestId)
1111
{

0 commit comments

Comments
 (0)