added compablity with dotnet5+ and switched to GHA #23
This file contains 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 and Deploy | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
defaults: | |
run: | |
working-directory: src | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8 | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Install dotnet-script | |
run: dotnet tool install --global dotnet-script | |
shell: pwsh | |
- name: Update version in project | |
run: dotnet script "${{ github.workspace }}/UpdateVersion.csx" | |
env: | |
GITHUB_RUN_NUMBER: ${{ github.run_number }} | |
shell: pwsh | |
- name: Build | |
run: dotnet build --configuration ${{ matrix.configuration }} --verbosity minimal | |
- name: Pack NuGet package [Debug] | |
if: matrix.configuration == 'Debug' | |
run: dotnet pack --configuration Debug --output ./nupkg | |
- name: Pack NuGet package [Release] | |
if: matrix.configuration == 'Release' | |
run: dotnet pack --configuration Release --output ./nupkg | |
- name: Push NuGet package | |
if: matrix.configuration == 'Release' | |
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Create GitHub Release | |
if: matrix.configuration == 'Release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.new_version }} | |
name: ${{ env.new_version }} | |
files: ./nupkg/*.nupkg | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |