GitVersion and versioning updates #30
This file contains hidden or 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: Messaging CI/CD | |
| permissions: | |
| contents: read | |
| packages: write | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| jobs: | |
| calculate-version: | |
| name: "Calculate Version" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.gitversion.outputs.SemVer }} | |
| nuget-version: ${{ steps.gitversion.outputs.NuGetVersion }} | |
| assembly-version: ${{ steps.gitversion.outputs.AssemblySemVer }} | |
| file-version: ${{ steps.gitversion.outputs.AssemblySemFileVer }} | |
| informational-version: ${{ steps.gitversion.outputs.InformationalVersion }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v4.0.1 | |
| with: | |
| versionSpec: '6.x' | |
| - name: Determine Version | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v4.0.1 | |
| - name: Display GitVersion outputs | |
| run: | | |
| echo "🔍 CD Version Calculation:" | |
| echo "Branch: ${{ github.ref }}" | |
| echo "Version: ${{ steps.gitversion.outputs.SemVer }}" | |
| echo "NuGet Version: ${{ steps.gitversion.outputs.NuGetVersion }}" | |
| echo "Assembly Version: ${{ steps.gitversion.outputs.AssemblySemVer }}" | |
| echo "File Version: ${{ steps.gitversion.outputs.AssemblySemFileVer }}" | |
| echo "Informational Version: ${{ steps.gitversion.outputs.InformationalVersion }}" | |
| build: | |
| needs: calculate-version | |
| name: "Build and Test" | |
| strategy: | |
| matrix: | |
| include: | |
| - dotnet: '8.0.x' | |
| dotnet-framework: 'net8.0' | |
| os: ubuntu-latest | |
| - dotnet: '8.0.x' | |
| dotnet-framework: 'net8.0' | |
| os: windows-latest | |
| - dotnet: '9.0.x' | |
| dotnet-framework: 'net9.0' | |
| os: ubuntu-latest | |
| - dotnet: '9.0.x' | |
| dotnet-framework: 'net9.0' | |
| os: windows-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET ${{ matrix.dotnet }} | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet }} | |
| - name: Restore dependencies | |
| run: dotnet restore -p:TargetFramework=${{ matrix.dotnet-framework }} | |
| - name: Build | |
| run: dotnet build --no-restore -c Release -f ${{ matrix.dotnet-framework }} | |
| env: | |
| GitVersion_SemVer: ${{ needs.calculate-version.outputs.version }} | |
| GitVersion_AssemblySemVer: ${{ needs.calculate-version.outputs.assembly-version }} | |
| GitVersion_AssemblySemFileVer: ${{ needs.calculate-version.outputs.file-version }} | |
| GitVersion_InformationalVersion: ${{ needs.calculate-version.outputs.informational-version }} | |
| GitVersion_NuGetVersion: ${{ needs.calculate-version.outputs.nuget-version }} | |
| - name: Test (Ubuntu) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: dotnet test --no-build --verbosity normal -c Release -f ${{ matrix.dotnet-framework }} | |
| - name: Test (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: dotnet test --no-build --verbosity normal -c Release -f ${{ matrix.dotnet-framework }} --filter "DB!=SQLServer" | |
| publish: | |
| needs: [calculate-version, build] | |
| name: "Publish Packages (Development)" | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| publish-to-nuget: false | |
| build-configuration: 'Release' | |
| version: ${{ needs.calculate-version.outputs.version }} | |
| nuget-version: ${{ needs.calculate-version.outputs.nuget-version }} | |
| assembly-version: ${{ needs.calculate-version.outputs.assembly-version }} | |
| informational-version: ${{ needs.calculate-version.outputs.informational-version }} | |
| secrets: inherit | |
| clean: | |
| needs: publish | |
| name: "Clean Old Packages" | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
| uses: ./.github/workflows/clean-packages.yml |