Skip to content

Commit

Permalink
Create ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
awaescher authored May 10, 2024
1 parent 9a1b7b9 commit 8a16eea
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: .NET Build, Test, and Publish Nuget Package

on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Fetch all history for all tags and branches
run: |
git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch --prune --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'

- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v0.9.7

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore src/FluentTransitions.sln

- name: Build
run: dotnet build src --no-restore --configuration=Release /p:Version=${{steps.gitversion.outputs.semVer}}

- name: Test
run: dotnet test src --no-build --configuration=Release --verbosity normal

- name: pack nuget packages
run: dotnet pack src --output nupkgs --configuration=Release --no-restore --no-build /p:PackageVersion=${{steps.gitversion.outputs.semVer}}

- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{steps.gitversion.outputs.semVer}}
name: Release ${{steps.gitversion.outputs.semVer}}
if: github.event_name != 'pull_request'

- name: upload nuget package
if: github.event_name != 'pull_request'
run: dotnet nuget push nupkgs/FluentTransitions*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

0 comments on commit 8a16eea

Please sign in to comment.