Skip to content

simple change and remove unused tests #428

simple change and remove unused tests

simple change and remove unused tests #428

name: Publish Nuget Preview Package and deploy Test App
on:
push:
branches:
- '**'
env:
AZURE_WEBAPP_NAME: MudEx
AZURE_WEBAPP_PACKAGE_PATH: SampleApplication/publish
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.MudEx_016e }}
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: Samples/MainSample.WebAssembly
jobs:
build_and_deploy_preview_package:
runs-on: ubuntu-latest
steps:
- name: Set Branch Name as Environment Variable
run: |
# Extract branch name
BRANCH_NAME=${GITHUB_REF#refs/heads/}
# Ensure branch name is safe for NuGet versioning (replace '/' with '-')
SAFE_BRANCH_NAME=${BRANCH_NAME////-}
# Set SAFE_BRANCH_NAME as an environment variable for subsequent steps
echo "SAFE_BRANCH_NAME=$SAFE_BRANCH_NAME" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore ./MudBlazor.Extensions/MudBlazor.Extensions.csproj
- name: First Build (ignore errors)
continue-on-error: true
run: dotnet build ./MudBlazor.Extensions/MudBlazor.Extensions.csproj --configuration Debug --no-restore
- name: Build with Branch Name Suffix
shell: pwsh
run: |
dotnet build ./MudBlazor.Extensions/MudBlazor.Extensions.csproj -p:VersionSuffix=prev-$([System.DateTime]::Now.ToString('yyMMddHHm'))-$env:SAFE_BRANCH_NAME --configuration Debug --no-restore
#- name: Run Tests
# run: dotnet test ./MudBlazor.Extensions.Tests/MudBlazor.Extensions.Tests.csproj
- name: Publish Package
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: pwsh
run: |
Get-ChildItem -Path MudBlazor.Extensions/bin/Debug -Filter *.nupkg | ForEach-Object {
dotnet nuget push $_.FullName -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json --skip-duplicate
}
deploy_application_to_azure:
needs: build_and_deploy_preview_package
runs-on: windows-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
# Delay to ensure the Nuget package is indexed before Azure deployment
- name: Delay
run: sleep 300
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
- name: Publish Artifacts
uses: actions/[email protected]
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}