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 | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout code | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
| - name: setup dotnet environment | ||
| uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d | ||
| with: | ||
| dotnet-version: '9.0' | ||
| - run: dotnet --info | ||
| - name: restore dependencies | ||
| run: dotnet restore | ||
| - name: build | ||
| run: dotnet build --configuration Release | ||
| - name: run test | ||
| run: dotnet test --configuration Release --no-restore --no-build --verbosity normal | ||
| publish-artifacts: | ||
| runs-on: ubuntu-latest | ||
| name: publish artifacts | ||
| needs: test | ||
| steps: | ||
| - name: checkout code | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
| with: | ||
| fetch-depth: 1 | ||
| - name: setup dotnet environment | ||
| uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d | ||
| with: | ||
| dotnet-version: '9.0' | ||
| - run: dotnet --info | ||
| - name: restore dependencies | ||
| run: dotnet restore | ||
| - name: extract package version from csproj | ||
| run: | | ||
| BASE_VERSION=$(grep -oPm1 "(?<=<Version>)[^<]+" **/*.csproj) | ||
| echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV | ||
| echo "Detected base version: $BASE_VERSION" | ||
| - name: generate nuget package | ||
| run: dotnet pack --configuration Release --output artifacts | ||
| - name: upload artifact | ||
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 | ||
| env: | ||
| ARTIFACT: ${{ BASE_VERSION }}-${{ github.sha }} | ||
| with: | ||
| name: ${{ env.ARTIFACT }} | ||
| path: artifacts/ | ||