-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (61 loc) · 2.43 KB
/
azure-webapps-dotnet-core.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
74
75
# This workflow will build and push a .NET Core app to an Azure Web App when a commit is pushed to your default branch.
name: Build and deploy ASP.Net Core app to an Azure Web App
env:
AZURE_WEBAPP_NAME: kosli-dev-WaveApp # set this to the name of your Azure Web App
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.204' # set this to the .NET Core version to use
KOSLI_ORG: kosli
KOSLI_FLOW: WaveApp-ci
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN_PROD }}
KOSLI_TRAIL: ${{ github.sha }}
on:
push:
branches: [ "main" ]
workflow_dispatch:
permissions:
id-token: write
contents: read
attestations: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Kosli CLI
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ vars.KOSLI_CLI_VERSION }}
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and publish with dotnet
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp'
- name: Attest artifact to Kosli
run: |
kosli attest artifact "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp" \
--artifact-type dir \
--name webapp
- name: Change appsettings.Development.json to test .kosli_ignore
run:
jq '.Logging.LogLevel.Default = "Debug"' "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp/appsettings.Development.json" > temp.json
&& mv temp.json "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp/appsettings.Development.json"
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp"
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using Azure Credentials'
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/WaveApp'
- name: logout
run: |
az logout