Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiannuzzi committed Mar 12, 2021
0 parents commit cc7d69c
Show file tree
Hide file tree
Showing 16 changed files with 1,247 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "5.0.211103",
"commands": [
"dotnet-format"
]
}
}
}
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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: 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
Loading

0 comments on commit cc7d69c

Please sign in to comment.