ci: 👷 using .nuspec for Template Nuget package #98
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# https://github.com/rhysd/actionlint | |
name: Build-Test | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
env: | |
DOTNET_VERSION: "8.0.*" | |
jobs: | |
pre-checks: | |
name: Pre-Checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Conventional Commits Check | |
uses: amannn/action-semantic-pull-request@v5 | |
# Only run on pull request events | |
if: github.event_name == 'pull_request' | |
id: check-pull-request-title-conventional-commits | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# npm install, runs `prepare` script automatically in the initialize step | |
- name: Install NPM Dependencies | |
run: npm install | |
- name: Run Format Task | |
run: npm run format | |
- name: Run Style Task | |
run: npm run style | |
- name: Run Analyzers Task | |
run: npm run analyzers | |
build-test: | |
runs-on: ubuntu-latest | |
needs: pre-checks | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# https://github.com/dotnet/Nerdbank.GitVersioning/blob/main/doc/cloudbuild.md#github-actions | |
fetch-depth: 0 # doing deep clone and avoid shallow clone so nbgv can do its work. | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Cache NuGet packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
key: nuget-cache-${{ runner.os }}-${{ env.DOTNET_VERSION }}-build-test | |
# https://github.com/dotnet/Nerdbank.GitVersioning/blob/main/doc/nbgv-cli.md | |
- name: Install Nerdbank.GitVersioning | |
run: dotnet tool install -g nbgv | |
- name: Get PackageVersion | |
id: get_version | |
run: | | |
nugetVersion=$(nbgv get-version | grep "NuGetPackageVersion" | awk -F': ' '{print $2}' | xargs) | |
echo "NuGetPackageVersion: $nugetVersion" | |
echo "::set-output name=nuget_version::$nugetVersion" | |
- name: Restore dependencies | |
run: dotnet restore Vertical.Slice.Template.sln | |
- name: Build Version ${{ steps.get_version.outputs.nuget_version }} | |
run: dotnet build Vertical.Slice.Template.sln -c Release --no-restore | |
- name: Test Version ${{ steps.get_version.outputs.nuget_version }} | |
run: | | |
dotnet test Vertical.Slice.Template.sln -c Release --no-restore --no-build |