From 892bcf1255e4accf91e459c5b25d7bd8e11ff2ad Mon Sep 17 00:00:00 2001 From: Josh Close Date: Mon, 22 Jan 2024 15:28:09 -0600 Subject: [PATCH] Workflow. --- .github/workflows/ci.yaml | 13 ++----------- .github/workflows/publish.yaml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a47c47fab..d8bd966d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,22 +1,13 @@ 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 @@ -24,6 +15,6 @@ jobs: - 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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 000000000..bd99800d3 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -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 }}