mirror of
https://github.com/fiodarsazanavets/aspire-13-examples.git
synced 2026-08-04 09:48:50 +00:00
Improved naming and added a sample of GitHub action pipeline
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
# Run when commits are pushed to mainline branch (main or master)
|
||||
# Set this to the mainline branch you are using
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
|
||||
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
|
||||
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
|
||||
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
|
||||
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Make sure the right .NET SDK is available
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
|
||||
- name: Install azd
|
||||
uses: Azure/setup-azd@v1.0.0
|
||||
|
||||
- name: Install .NET Aspire workload
|
||||
run: dotnet workload install aspire
|
||||
|
||||
# ---------- CI: build & test ----------
|
||||
- name: Restore
|
||||
run: dotnet restore ./AspireApp.sln
|
||||
|
||||
- name: Build
|
||||
run: dotnet build ./AspireApp.sln --configuration Release --no-restore
|
||||
|
||||
- name: Test
|
||||
run: dotnet test ./AspireApp.sln --configuration Release --no-build
|
||||
# If tests fail here, the job stops and nothing below runs
|
||||
# --------------------------------------
|
||||
|
||||
- name: Log in with Azure (Federated Credentials)
|
||||
run: |
|
||||
azd auth login `
|
||||
--client-id "$Env:AZURE_CLIENT_ID" `
|
||||
--federated-credential-provider "github" `
|
||||
--tenant-id "$Env:AZURE_TENANT_ID"
|
||||
shell: pwsh
|
||||
|
||||
- name: Provision Infrastructure
|
||||
run: azd provision --no-prompt
|
||||
env:
|
||||
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
|
||||
|
||||
- name: Deploy Application
|
||||
run: azd deploy --no-prompt
|
||||
|
||||
Reference in New Issue
Block a user