This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: TookyPlay | |
KOSLI_FLOW: WaveApp-ci | |
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }} | |
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 }} | |
- name: Create Kosli Flow | |
run: | |
kosli create flow "${{ env.KOSLI_FLOW }}" | |
--description="Build and deploy the WaveApp" | |
--use-empty-template | |
- name: Begin Kosli Trail | |
run: | |
kosli begin trail "${{ env.KOSLI_TRAIL }}" | |
--description="${{ github.actor }} - $(git log -1 --pretty=%B)" | |
- 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: 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 |