build(deps): bump the all-dependencies group across 1 directory with … #642
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: Main Workflow | |
| on: | |
| push: | |
| branches: | |
| - '**' # Matches all branches | |
| pull_request: | |
| branches: | |
| - '**' # Matches all branches | |
| workflow_dispatch: | |
| inputs: | |
| force_build: | |
| description: 'Forces a build even if no changes are detected' | |
| required: true | |
| default: 'false' | |
| force_publish: | |
| description: 'Forces a publish even if no changes are detected' | |
| required: true | |
| default: 'false' | |
| jobs: | |
| ci: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| id-token: write | |
| contents: read | |
| checks: write | |
| env: | |
| build: false | |
| outputs: | |
| change_detection_src: ${{ steps.change_detection.outputs.src }} | |
| build: ${{ env.build }} | |
| semVer: ${{env.GitVersion_SemVer}} | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: tools - dotnet - install | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.x' | |
| - name: tools - gitversion - install | |
| uses: gittools/actions/gitversion/setup@v3.2.1 | |
| with: | |
| versionSpec: '5.x' | |
| preferLatestVersion: true | |
| - name: tools - gitversion - execute | |
| uses: gittools/actions/gitversion/execute@v3.2.1 | |
| with: | |
| useConfigFile: true | |
| configFilePath: GitVersion.yaml | |
| - name: tools - detect changes | |
| id: change_detection | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| base: ${{ github.ref }} | |
| filters: | | |
| src: | |
| - 'src/**' | |
| - 'ES.FX.slnx' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| build: | |
| - 'playground/**' | |
| - 'tests/**' | |
| - 'src/**' | |
| - 'ES.FX.slnx' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| - name: tools - evaluate build flag | |
| if: steps.change_detection.outputs.build == 'true' || | |
| github.event.inputs.force_build == 'true' || | |
| github.event.inputs.force_publish == 'true' || | |
| github.event_name == 'pull_request' | |
| run: echo "build=true" >> $GITHUB_ENV | |
| - name: cache - nuget | |
| if: ${{ env.build == 'true' }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: dotnet restore | |
| if: ${{ env.build == 'true' }} | |
| run: dotnet restore | |
| - name: dotnet build | |
| if: ${{ env.build == 'true' }} | |
| run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}} | |
| - name: dotnet test | |
| if: ${{ env.build == 'true' }} | |
| run: dotnet test --no-build --configuration Release --verbosity normal | |
| - name: test-reporter | |
| uses: dorny/test-reporter@v2 | |
| if: ${{ env.build == 'true' && github.event.pull_request.head.repo.fork == false }} | |
| with: | |
| name: Test Results | |
| path: .artifacts/TestResults/*.trx | |
| reporter: dotnet-trx | |
| - name: artifacts - nuget - gather | |
| if: ${{ env.build == 'true' }} | |
| run: | | |
| mkdir -p .artifacts/nuget | |
| find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \; | |
| - name: artifacts - nuget - upload | |
| if: ${{ env.build == 'true' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-nuget-${{env.GitVersion_SemVer}} | |
| path: .artifacts/nuget/*.nupkg | |
| cd: | |
| name: CD | |
| runs-on: ubuntu-latest | |
| needs: ci | |
| if: > | |
| (github.event.inputs.force_publish == 'true' || | |
| (needs.ci.outputs.change_detection_src == 'true' && github.event_name == 'push')) && | |
| (github.ref == 'refs/heads/main' || | |
| github.ref == 'refs/heads/develop' || | |
| startsWith(github.ref, 'refs/heads/feature/') || | |
| startsWith(github.ref, 'refs/heads/releases/') || | |
| startsWith(github.ref, 'refs/heads/hotfix/')) | |
| env: | |
| build: ${{ needs.ci.outputs.build }} | |
| semVer: ${{ needs.ci.outputs.semVer }} | |
| changes_src: ${{ needs.ci.outputs.change_detection_src }} | |
| steps: | |
| - name: artifacts - nuget - download | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifacts-nuget-${{env.semVer}} | |
| path: .artifacts/nuget | |
| - name: dotnet nuget push - GitHub | |
| run: | | |
| dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/emberstack/index.json" | |
| for pkg in .artifacts/nuget/*.nupkg; do | |
| dotnet nuget push "$pkg" --source "github" --api-key ${{ secrets.ES_GITHUB_PAT }} --skip-duplicate | |
| done | |
| - name: dotnet nuget push - NuGet | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| for pkg in .artifacts/nuget/*.nupkg; do | |
| dotnet nuget push "$pkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.ES_NUGET_APIKEY }} --skip-duplicate | |
| done | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: github - create release | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create version/v${{env.semVer}} --title "v${{env.semVer}}" --generate-notes |