ci: align build workflow with TrellisFramework #183
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: Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main, 'release/v**', 'dev/**' ] | |
| pull_request: | |
| branches: [ main, 'dev/**' ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Setup versioning | |
| run: | | |
| dotnet tool install --global nbgv | |
| nbgv cloud | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore -c Release | |
| - name: Test | |
| run: dotnet test --no-build -c Release -l "console;verbosity=normal" | |
| - name: Pack | |
| if: ${{ success() && !github.base_ref }} | |
| run: dotnet pack --no-build --verbosity normal -c Release -o artifacts/ | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| if: ${{ success() && !github.base_ref }} | |
| with: | |
| name: artifact | |
| path: artifacts/ |