1
- name : Azure Bicep
2
-
3
- on :
4
- workflow_dispatch
1
+ name : .NET CI
5
2
6
3
env :
7
- targetEnv : dev
8
-
4
+ registryName : p5tgcusa4unsumpnpreg.azurecr.io
5
+ repositoryName : techexcel/dotnetcoreapp
6
+ dockerFolderPath : ./src/Application/src/RazorPagesTestSample
7
+ tag : ${{github.run_number}}
8
+
9
+ on :
10
+ push :
11
+ branches : [ main ]
12
+ paths : src/Application/**
13
+ pull_request :
14
+ branches : [ main ]
15
+ paths : src/Application/**
16
+ # Allows you to run this workflow manually from the Actions tab
17
+ workflow_dispatch :
9
18
jobs :
10
- build-and-deploy :
19
+ build :
20
+
11
21
runs-on : ubuntu-latest
12
- permissions :
13
- contents : read
14
- pages : write
15
- id-token : write
16
- steps :
17
- # Checkout code
18
- - uses : actions/checkout@main
19
22
20
- # Log into Azure
21
-
23
+ steps :
24
+ - uses : actions/checkout@v3
25
+ - name : Setup .NET
26
+ uses : actions/setup-dotnet@v3
22
27
with :
23
- client-id : ${{ secrets.AZURE_CLIENT_ID }}
24
- tenant-id : ${{ secrets.AZURE_TENANT_ID }}
25
- subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
26
- enable-AzPSSession : true
28
+ dotnet-version : 8.0
29
+
30
+ - name : Restore dependencies
31
+ run : dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
32
+ - name : Build
33
+ run : dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
34
+ - name : Test
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
27
41
28
- # Deploy ARM template
29
- - name : Run ARM deploy
30
- uses : azure/arm-deploy@v1
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
+
31
49
with :
32
- subscriptionId : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33
- resourceGroupName : ${{ secrets.AZURE_RG }}
34
- template : ./src/InfrastructureAsCode/main.bicep
35
- parameters : environment=${{ env.targetEnv }}
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
0 commit comments