diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..2febf81 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,53 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: NugetRevisionDemo + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +env: + majorVersion: 2 + minorVersion: 0 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Version - Modify version number + uses: mingjun97/file-regex-replace@v1 + env: + version-number: ${{ env.majorVersion }}.${{ env.minorVersion }}.${{ github.run_number }}.0 + with: + regex: '[[0-9]+(\.([0-9]+|\*)){1,3}' + replacement: '${{ env.version-number}}' + flags: "gi" # Optional, defaults to "g" + include: '.csproj' # Optional, defaults to ".*" + exclude: '.^' # Optional, defaults to '.^' + encoding: 'utf8' # Optional, defaults to 'utf8' + path: '.' # Optional, defaults to '.' + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.2 + with: + # Artifact name + name: NugetPackage + path: '**/*.nupkg'