Skip to content

Commit 31c5bea

Browse files
committed
GitHub actions (#388)
* Build script option -SkipTests instead of -RunTests * Use version suffix only on dev branch
1 parent 5b502c6 commit 31c5bea

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.github/workflows/pr-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
- uses: actions/checkout@v2
1515

1616
- name: Run build and tests
17-
run: ./Build.ps1 -RunTests $true
17+
run: ./Build.ps1

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515

1616
- name: Run build
17-
run: ./Build.ps1
17+
run: ./Build.ps1 -SkipTests $true
1818

1919
- name: Read version from csproj
2020
run: |
@@ -24,15 +24,15 @@ jobs:
2424
echo "Found version $versionMatch"
2525
2626
- name: Create GitHub releease
27-
# if: ${{ github.ref_name == 'master' }}
27+
if: ${{ github.ref_name == 'master' }}
2828
uses: "marvinpinto/action-automatic-releases@latest"
2929
with:
3030
repo_token: "${{ secrets.GITHUB_TOKEN }}"
31-
automatic_release_tag: "v${{ env.VERSION }}-test"
32-
draft: true
33-
title: "v${{ env.VERSION }}-test"
31+
automatic_release_tag: "v${{ env.VERSION }}"
32+
title: "v${{ env.VERSION }}"
3433
files: |
3534
artifacts/*.nupkg
3635
artifacts/*.snupkg
3736
38-
# TODO: upload to nuget.org
37+
- name: Publish to nuget.org
38+
run: nuget push artifacts\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}

Build.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
param (
33
[Parameter(Mandatory = $false)]
44
[System.Boolean]
5-
$RunTests = $false
5+
$SkipTests = $false
66
)
77

88
echo "build: Build started"
@@ -18,7 +18,7 @@ if(Test-Path .\artifacts) {
1818

1919
$branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL];
2020
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL];
21-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
21+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -ne "dev" -and $revision -ne "local"]
2222

2323
echo "build: Version suffix is $suffix"
2424

@@ -37,7 +37,7 @@ foreach ($src in ls src/*) {
3737
Pop-Location
3838
}
3939

40-
if ($RunTests -eq $true) {
40+
if ($SkipTests -eq $false) {
4141
foreach ($test in ls test/*.PerformanceTests) {
4242
Push-Location $test
4343

0 commit comments

Comments
 (0)