Skip to content

Commit

Permalink
Workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshClose committed Jan 22, 2024
1 parent cc9e88f commit 892bcf1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
name: CI
on: [push, pull_request]
jobs:
build:
ci:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git Semantic Version
id: gitversion
uses: PaulHatch/semantic-version@v5.3.0
with:
tag_prefix: ""
- name: Set Version Environment Variables
run: |
echo "ASSEMBLY_VERSION=${{ steps.gitversion.outputs.major }}.0.0.0" >> "$GITHUB_ENV"
echo "FILE_VERSION=${{ steps.gitversion.outputs.version }}.${{ github.run_number }}" >> "$GITHUB_ENV"
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Display .NET Version
run: dotnet --version
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release -p:AssemblyVersion=${{ env.ASSEMBLY_VERSION }} -p:FileVersion=${{ env.FILE_VERSION }}
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --configuration Release --no-restore --verbosity normal
30 changes: 30 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish NuGet Package
on:
push:
tags: ["*"]
workflow_dispatch:
jobs:
publish:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git Semantic Version
id: gitversion
uses: PaulHatch/semantic-version@v5.3.0
with:
tag_prefix: ""
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Display .NET Version
run: dotnet --version
- name: Build
run: dotnet build src/CsvHelper/CsvHelper.proj --configuration Release -p:AssemblyVersion=${{ steps.gitversion.outputs.major }}.0.0.0 -p:FileVersion=${{ steps.gitversion.outputs.version }}.${{ github.run_number }}
- name: Create NuGet Package
run: dotnet pack src/CsvHelper/CsvHelper.proj --no-restore --configuration Release -o output -p:PackageVersion=${{ steps.gitversion.outputs.version }}
- name: Display Output
run: dir output
- name: Publish NuGet Package
run: dotnet nuget push output/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

0 comments on commit 892bcf1

Please sign in to comment.