Skip to content

Commit be5f909

Browse files
committed
Making script publish to nuget when creating releases
1 parent 23e58ea commit be5f909

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,37 @@ jobs:
1212
build:
1313
runs-on: windows-latest
1414

15+
env:
16+
# Stop wasting time caching packages
17+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
18+
# Disable sending usage data to Microsoft
19+
DOTNET_CLI_TELEMETRY_OPTOUT: true
20+
1521
steps:
22+
- name: Set version
23+
id: versioner
24+
run: |
25+
if($env:GITHUB_EVENT_NAME -like "release") {
26+
#example refs/pull/7/merge
27+
$parts = $env:GITHUB_REF.Split("/")
28+
$version=$parts[2]
29+
}
30+
else {
31+
$version="0.0.$env:GITHUB_RUN_NUMBER"
32+
}
33+
echo "::set-output name=VERSION::$version"
34+
Write-Host "$env:GITHUB_EVENT_NAME ($env:GITHUB_REF) generated version $version"
1635
- uses: actions/checkout@v2
17-
- name: Setup .NET Core
18-
uses: actions/setup-dotnet@v1
19-
with:
20-
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
2136
- name: Create folder
2237
run: mkdir BuildReports
2338
- name: Install dependencies
2439
run: dotnet restore --verbosity m > BuildReports/Restore.txt
2540
- name: Build
26-
run: dotnet build --no-restore --verbosity m --configuration Release > BuildReports/Build.txt
41+
run: |
42+
Write-Host "Version ${{steps.versioner.outputs.VERSION}}"
43+
dotnet build --no-restore --verbosity m --configuration Release /p:Version=${{ steps.versioner.outputs.VERSION }} > BuildReports/Build.txt
2744
- name: Test
28-
run: dotnet test --configuration Release > BuildReports/Tests.txt
45+
run: dotnet test --no-build --configuration Release > BuildReports/Tests.txt
2946
- name: Copy generated nuget file
3047
shell: bash
3148
run: find . -name "SystemTestingTools*.nupkg" -exec cp "{}" ./ \;

0 commit comments

Comments
 (0)