Skip to content

Commit

Permalink
Update build script, and fix build warning
Browse files Browse the repository at this point in the history
  • Loading branch information
22222 committed Dec 17, 2021
1 parent e3737fd commit 53caad5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
release:
types:
- published

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
Expand All @@ -33,21 +32,26 @@ jobs:
- name: Test
run: dotnet test -c Release --no-build
- name: Pack
if: matrix.os == 'windows-latest' && github.event_name == 'release'
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/v')
shell: pwsh
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
VERSION="${VERSION//v}"
echo Version: $VERSION
dotnet pack -c Release -p:Version=$Version -p:PackageVersion=$VERSION -p:AssemblyVersion=$Version -p:FileVersion=$Version -p:InformationalVersion=$Version -o nupkg src/CsvTextFieldParser/CsvTextFieldParser.csproj
$GITHUB_REF = $env:GITHUB_REF
if (!($GITHUB_REF -match 'refs/tags/v(\d+\.\d+\.\d+)')) {
Write-Error "Failed to parse version from GITHUB_REF: $GITHUB_REF"
exit 1
}
$Version = $matches[1]
Write-Host "Version: $Version"
& dotnet pack -c Release -p:Version=$Version -p:PackageVersion=$VERSION -p:AssemblyVersion=$Version -p:FileVersion=$Version -p:InformationalVersion=$Version CsvTextFieldParser/CsvTextFieldParser.csproj
exit $LastExitCode
- name: Upload Artifact Nupkg
if: matrix.os == 'windows-latest' && github.event_name == 'release'
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./CsvTextFieldParser/bin/Release/*.nupkg
- name: Upload Artifact Bin
if: matrix.os == 'windows-latest' && github.event_name == 'release'
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v2
with:
name: bin
Expand Down
2 changes: 1 addition & 1 deletion CsvTextFieldParser.Tests/VbCsvTextFieldParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void SetDelimiters_Empty()
{
parser.Delimiters = new string[0];
var actual = parser.Delimiters;
Assert.Equal(0, actual.Length);
Assert.Empty(actual);
}
}

Expand Down
1 change: 0 additions & 1 deletion CsvTextFieldParser/CsvTextFieldParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<PackageLicenseExpression>MIT OR Unlicense</PackageLicenseExpression>
<PackageTags>csv parser CsvParser CsvTextFieldParser TextFieldParser</PackageTags>
<Company />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>CodeAnalysis.ruleset</CodeAnalysisRuleSet>
<Version>0.0.0</Version>
Expand Down

0 comments on commit 53caad5

Please sign in to comment.