@rliberoff/update semantic kernel ~1.0.1~ 1.1.0 #46
Workflow file for this run
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
name: ENMARCHA NuGet | |
on: | |
push: | |
branches: | |
- releases/** | |
- main | |
paths-ignore: | |
- '/**/*.md' | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- releases/** | |
- main | |
workflow_dispatch: | |
env: | |
BuildConfiguration: ${{ startsWith(github.ref, 'refs/heads/releases') && 'Release' || 'Debug' }} | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
outputs: | |
release_version: ${{ steps.PassOutputReleaseVersion.releaseVersion }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set Java for SonarCloud | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: '21' | |
- name: Using .NET from 'global.json' | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Restore NuGet Packages | |
run: dotnet restore --configfile NuGet.config --verbosity Minimal | |
- name: Sonar - Install SonarCloud scanners | |
run: dotnet tool install --global dotnet-sonarscanner --version 5.15.0 | |
- name: Sonar - Begin Analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: dotnet-sonarscanner begin /k:"${{ secrets.SONAR_PROJECT_KEY }}" /o:"${{ secrets.SONAR_ORGANIZATION }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/tst/**/*" /d:sonar.cs.opencover.reportsPaths="**/tst/**/coverage.opencover.xml" | |
- name: Test | |
run: dotnet test --nologo --no-restore --collect:"XPlat Code Coverage" --configuration ${{env.BuildConfiguration}} --settings coverlet.runsettings | |
- name: Install Report Generator Tool | |
run: dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools --ignore-failed-sources | |
- name: Generate Coverage Report | |
run: ./tools/reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:coverage/Cobertura -reporttypes:'MarkdownSummaryGithub;Cobertura' | |
- name: Publish Coverage Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: coverage/Cobertura/ | |
- name: Write Coverage Report to Job Summary | |
run: cat coverage/Cobertura/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
- name: Build & Pack Libraries | |
run: dotnet pack --nologo --no-restore --configuration ${{env.BuildConfiguration}} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:SourceLinkCreate=true -p:DebugType=full --output nupkg | |
- name: Sonar - End Analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
- name: Zip Libraries | |
run: | | |
cd ${{ github.workspace }}/nupkg | |
zip -r nupkg.zip * | |
mv ./nupkg.zip ${{ github.workspace }} | |
- name: Upload Libraries for Continuous Deployment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: enmarcha-libraries-${{ github.run_number }} | |
path: nupkg.zip | |
CD: | |
runs-on: ubuntu-latest | |
needs: CI | |
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/heads/releases') || github.ref == 'refs/heads/main') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Read and Store Version | |
id: PassOutputReleaseVersion | |
shell: pwsh | |
run: | | |
$xml = [Xml] (Get-Content "${{ github.workspace }}/Directory.Build.props") | |
$prefix = [System.Linq.Enumerable]::FirstOrDefault($xml.Project.PropertyGroup.VersionPrefix, [Func[object,bool]]{ param($x) $x -ne $null }) | |
$suffix = [System.Linq.Enumerable]::FirstOrDefault($xml.Project.PropertyGroup.VersionSuffix, [Func[object,bool]]{ param($x) $x -ne $null }) | |
$release_version = ($prefix, $suffix) | ? { $_ } | Join-String -Separator "-" | |
echo "RELEASE_VERSION=$release_version" >> $env:GITHUB_OUTPUT | |
- name: Download Libraries for Continuous Deployment | |
uses: actions/download-artifact@v3 | |
with: | |
name: enmarcha-libraries-${{ github.run_number }} | |
path: ./ | |
- name: Unzip Libraries | |
run: | | |
cd ${{ github.workspace }} | |
unzip nupkg.zip -d nupkg | |
- name: Push Libraries to NuGet.org | |
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
- name: Create Tag | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git tag -a "Release-${{ steps.PassOutputReleaseVersion.outputs.RELEASE_VERSION }}" -m "Version from build ${{ github.run_number }}" | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ steps.PassOutputReleaseVersion.outputs.RELEASE_VERSION }}" | |
release_name: "Release ${{ steps.PassOutputReleaseVersion.outputs.RELEASE_VERSION }}" | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./nupkg.zip | |
asset_name: enmarcha-libraries-${{ steps.PassOutputReleaseVersion.outputs.RELEASE_VERSION }}.zip | |
asset_content_type: application/zip |