Tweak workflow #136
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: .NET | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
working-directory: src | |
- name: Version | |
run: dotnet run --project GitTreeVersion -- version --apply | |
working-directory: src | |
- name: Build | |
run: dotnet build --no-restore | |
working-directory: src | |
- name: Configure Git for tests | |
run: | | |
git config --global user.email "you@example.com" | |
git config --global user.name "Your Name" | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
working-directory: src | |
- name: Pack | |
run: dotnet pack --configuration Release | |
working-directory: src | |
- name: NuGet push | |
env: | |
APIKEY: ${{ secrets.GitTreeVersionNuGetKey }} | |
run: dotnet nuget push GitTreeVersion/bin/Release/GitTreeVersion.*.nupkg --api-key $APIKEY --source https://api.nuget.org/v3/index.json | |
working-directory: src |