Skip to content

Kosli-fy the workflow #2

Kosli-fy the workflow

Kosli-fy the workflow #2

# 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:
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="Diff files from two traffic-lights"
--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 }}/myapp'
- name: Attest artifact to Kosli
run: |
kosli attest artifact "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp" \
--artifact-type dir \
--name webapp
# 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 }}/myapp'
- name: logout
run: |
az logout