|
15 | 15 | paths: src/Application/**
|
16 | 16 | # Allows you to run this workflow manually from the Actions tab
|
17 | 17 | workflow_dispatch:
|
18 |
| -jobs: |
19 |
| - build: |
20 |
| - |
21 |
| - runs-on: ubuntu-latest |
22 | 18 |
|
23 |
| - steps: |
24 |
| - - uses: actions/checkout@v3 |
25 |
| - - name: Setup .NET |
26 |
| - uses: actions/setup-dotnet@v3 |
27 |
| - with: |
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 |
| - - uses: actions/github-script@v6 |
37 |
| - if: failure() |
38 |
| - with: |
39 |
| - github-token: ${{secrets.GITHUB_TOKEN}} |
40 |
| - script: | |
41 |
| - let body = "${{ env.build_name }} Workflow Failure \n Build Number: ${{ github.run_number }} \n Build Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \n SHA: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) \n"; |
42 |
| - github.issues.create({ |
43 |
| - owner: context.repo.owner, |
44 |
| - repo: context.repo.repo, |
45 |
| - title: "${{ env.build_name }} Workflow ${{ github.run_number }} Failed! ", |
46 |
| - body: body |
47 |
| - }); |
48 |
| - |
| 19 | +jobs: |
49 | 20 | dockerBuildPush:
|
50 | 21 | runs-on: ubuntu-latest
|
51 |
| - needs: build |
52 | 22 |
|
53 | 23 | steps:
|
54 | 24 | - uses: actions/checkout@v3
|
55 | 25 |
|
56 | 26 | - name: Docker Login
|
57 |
| - # You may pin to the exact commit or the version. |
58 |
| - # uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c |
59 |
| - |
| 27 | + uses: docker/login-action@v1 |
60 | 28 | with:
|
61 |
| - # Server address of Docker registry. If not set then will default to Docker Hub |
62 | 29 | registry: ${{ secrets.ACR_LOGIN_SERVER }}
|
63 |
| - # Username used to log against the Docker registry |
64 | 30 | username: ${{ secrets.ACR_USERNAME }}
|
65 |
| - # Password or personal access token used to log against the Docker registry |
66 | 31 | password: ${{ secrets.ACR_PASSWORD }}
|
67 |
| - # Log out from the Docker registry at the end of a job |
68 |
| - logout: true |
69 | 32 |
|
70 | 33 | - name: Docker Build
|
71 |
| - run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath |
72 |
| - |
73 |
| - - name: Docker Push |
74 |
| - run: docker push $registryName/$repositoryName:$tag |
75 |
| - |
76 |
| - deploy-to-dev: |
77 |
| - |
78 |
| - runs-on: ubuntu-latest |
79 |
| - needs: dockerBuildPush |
80 |
| - environment: |
81 |
| - name: dev |
82 |
| - url: https://pickles808-dev.azurewebsites.net/ |
83 |
| - |
84 |
| - steps: |
85 |
| - - name: 'Login via Azure CLI' |
86 |
| - |
87 |
| - with: |
88 |
| - creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 34 | + run: docker build -t ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} -f ${{ env.dockerFolderPath }}/Dockerfile ${{ env.dockerFolderPath }} |
89 | 35 |
|
90 |
| - - uses: azure/webapps-deploy@v2 |
91 |
| - with: |
92 |
| - app-name: 'pickles808-dev' |
93 |
| - images: onfp77x2viod4.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}} |
94 |
| - |
95 |
| - deploy-to-test: |
96 |
| - |
97 |
| - runs-on: ubuntu-latest |
98 |
| - needs: deploy-to-dev |
99 |
| - environment: |
100 |
| - name: test |
101 |
| - url: https://pickles808-test.azurewebsites.net/ |
102 |
| - |
103 |
| - steps: |
104 |
| - - uses: actions/checkout@v3 |
105 |
| - |
106 |
| - - name: 'Login via Azure CLI' |
107 |
| - |
108 |
| - with: |
109 |
| - creds: ${{ secrets.AZURE_CREDENTIALS }} |
110 |
| - |
111 |
| - - uses: azure/webapps-deploy@v2 |
112 |
| - with: |
113 |
| - app-name: 'pickles808-test' |
114 |
| - images: onfp77x2viod4.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}} |
| 36 | + - name: Docker Push |
| 37 | + run: docker push ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} |
115 | 38 |
|
116 | 39 | deploy-to-prod:
|
117 |
| - |
118 | 40 | runs-on: ubuntu-latest
|
119 |
| - needs: deploy-to-test |
| 41 | + needs: dockerBuildPush |
120 | 42 | environment:
|
121 | 43 | name: prod
|
122 | 44 | url: https://pickles808-prod.azurewebsites.net/
|
|
132 | 54 | - uses: azure/webapps-deploy@v2
|
133 | 55 | with:
|
134 | 56 | app-name: 'pickles808-prod'
|
135 |
| - images: onfp77x2viod4.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}} |
| 57 | + images: ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} |
0 commit comments