fix bug where paths with spaces cause errors on build #41
Workflow file for this run
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
# Enforces the consistency of code formatting using `.editorconfig` and the `dotnet-format` tool. | |
check-format: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.201 | |
- name: Pin .NET Core SDK | |
run: dotnet new globaljson --sdk-version 5.0.201 | |
- name: Restore tools | |
run: dotnet tool restore | |
- name: Check format | |
run: dotnet format --check --folder T4.Build | |
build: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.201 | |
- name: Pin .NET Core SDK | |
run: dotnet new globaljson --sdk-version 5.0.201 | |
- name: Create package | |
shell: pwsh | |
run: | | |
if ("${{ github.ref }}" -like "refs/tags/v*") { | |
$tag = "${{ github.ref }}".SubString(11) | |
$version = (Select-Xml -path T4.Build/T4.Build.csproj -XPath "/Project/PropertyGroup/VersionPrefix/text()").node.Value | |
if (-not ($tag -eq $version)) { | |
echo "There is a mismatch between the project version ($version) and the tag ($tag)" | |
exit 1 | |
} | |
} else { | |
$suffix = 'g' + $(git rev-parse --short HEAD) | |
$params = "--version-suffix", $suffix | |
} | |
dotnet pack --configuration=Release @params | |
- name: Upload NuGet package artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nuget-package | |
path: T4.Build/bin/Release/T4.Build.*.nupkg | |
publish: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [check-format, build] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download NuGet package artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: nuget-package | |
- name: Publish to NuGet | |
run: dotnet nuget push T4.Build.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |