-
Notifications
You must be signed in to change notification settings - Fork 24
73 lines (61 loc) · 2.96 KB
/
examples-webapi-net7.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This workflow will build and push a .NET Core app to an Azure Web App when a commit is pushed to your default branch.
#
# This workflow assumes you have already created the target Azure App Service web app.
# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net60&pivots=development-environment-vscode
#
# To configure this workflow:
#
# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.
# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials
#
# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret.
# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret
#
# 3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the AZURE_WEBAPP_PACKAGE_PATH and DOTNET_VERSION environment variables below.
#
# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions
# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples
name: Build and deploy .NET 7 app to ACR (linux)
env:
IMAGE_NAME: epprofilerlinuxnet7
DOTNET_VERSION: '7.x' # set this to the .NET Core version to use
DOCKER_BUILD_CONTEXT: 'examples/EnableServiceProfilerNet7'
DOCKER_BUILD_FILE: 'examples/EnableServiceProfilerNet7/dockerfile'
on:
workflow_dispatch:
inputs:
image_version:
description: 'Image version. 1.0.0 for example.'
required: true
permissions:
contents: read
jobs:
docker_build_push_acr:
name: 'Docker Build and Push to ACR'
runs-on: ubuntu-latest
environment: production
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
name: Checkout source code
- name: Set up .NET ${{ env.DOTNET_VERSION }} SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Docker Login'
uses: docker/login-action@v2
with:
registry: ${{ secrets.ACR_ENDPOINT }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build the WebAPI image and push it to ACR
uses: docker/build-push-action@v4
with:
context: ${{ env.DOCKER_BUILD_CONTEXT }}
file: ${{ env.DOCKER_BUILD_FILE }}
push: true
tags: ${{ secrets.ACR_ENDPOINT }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.image_version }}