Align workflows and CI to .NET 9 #7
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: .NET CI + Publish NuGet | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Show SDKs (debug) | |
| run: dotnet --list-sdks | |
| - name: Restore | |
| run: dotnet restore eShopOnWeb.sln | |
| - name: Build | |
| run: dotnet build eShopOnWeb.sln --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test eShopOnWeb.sln --configuration Release --no-build | |
| pack-and-publish-common: | |
| needs: build-and-test | |
| # CD kun når det er et push til master (ikke PR) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| env: | |
| NUGET_FEED_SOURCE: https://pkgs.dev.azure.com/eShopOnWeb-SEM2/eShopOnWeb/_packaging/eShopOnWeb-nuget-feed/nuget/v3/index.json | |
| PACKAGE_VERSION: 1.0.${{ github.run_number }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Show SDKs (debug) | |
| run: dotnet --list-sdks | |
| - name: Restore | |
| run: dotnet restore eShopOnWeb.sln | |
| - name: Pack common libraries | |
| run: | | |
| mkdir -p ./nupkgs | |
| dotnet pack src/Microservices/CatalogMicroservice/CatalogMicroservice.Common/CatalogMicroservice.Common.csproj \ | |
| --configuration Release \ | |
| -o ./nupkgs \ | |
| /p:PackageVersion=${{ env.PACKAGE_VERSION }} | |
| - name: Configure Azure Artifacts source | |
| env: | |
| AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} | |
| run: | | |
| dotnet nuget add source "$NUGET_FEED_SOURCE" \ | |
| --name eShopOnWebFeed \ | |
| --username "github" \ | |
| --password "$AZURE_DEVOPS_PAT" \ | |
| --store-password-in-clear-text | |
| - name: Push packages to Azure DevOps feed | |
| run: | | |
| dotnet nuget push "./nupkgs/*.nupkg" \ | |
| --source eShopOnWebFeed \ | |
| --api-key AZ |