Skip to content

Commit

Permalink
build yaml tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-martinsmith committed Aug 20, 2024
1 parent c158f92 commit 62fa259
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ env:
DOTNET_VERSION: 6.0.x
NUGET_VERSION: 5.x
BUILD_CONFIG: Release
BUILD_TARGET: netstandard2.0
BUILD_PLATFORM: Any CPU
PACK_PARAMETERS: ''
NUGET_OUTPUT_FOLDER: nupkgs
PRIMARY_BRANCH: refs/heads/main

on:
push:
Expand Down Expand Up @@ -42,7 +44,7 @@ jobs:
branch='${{ github.ref }}'
package_suffix=''
if [ "$branch" != "refs/heads/main" ]
if [ "$branch" != "${{ env.PRIMARY_BRANCH }}" ]
then
package_suffix='-beta'
fi
Expand All @@ -57,7 +59,7 @@ jobs:
if [ "${{ github.event_name }}" == "pull_request" ]
then
should_publish=true
elif [ "${{ github.ref }}" == 'refs/heads/main' ]
elif [ "${{ github.ref }}" == '${{ env.PRIMARY_BRANCH }}' ]
then
should_publish=true
fi
Expand All @@ -83,7 +85,7 @@ jobs:
should_publish: ${{ env.should_publish }}

##########################################################
## Bulid DotNet projects
## Build DotNet projects
build:
name: Build .NET

Expand All @@ -104,10 +106,10 @@ jobs:
run: dotnet restore

- name: Build
run: dotnet build --configuration ${{ env.BUILD_CONFIG }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ needs.setup.outputs.product_version }}" /p:"AssemblyVersion=${{ needs.setup.outputs.assembly_version }}" --no-restore
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIG }} --framework ${{ env.BUILD_TARGET }} /p:"Platform=${{ env.BUILD_PLATFORM }}" /p:"Version=${{ needs.setup.outputs.product_version }}" /p:"AssemblyVersion=${{ needs.setup.outputs.assembly_version }}"

- name: Test
run: dotnet test --configuration ${{ env.BUILD_CONFIG }} --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage"
run: dotnet test --no-restore --no-build --configuration ${{ env.BUILD_CONFIG }} --verbosity normal --collect:"XPlat Code Coverage"

- name: Code Coverage Report
uses: irongut/[email protected]
Expand Down Expand Up @@ -150,9 +152,11 @@ jobs:
## Generate a Release and Tag in git
release:
name: Create GitHub Release
if: github.ref == 'refs/heads/main' && success()
if: github.ref == '${{ env.PRIMARY_BRANCH }}' && success()

needs: [setup, build]
needs:
- setup
- build

runs-on: ubuntu-latest

Expand All @@ -172,6 +176,7 @@ jobs:
tag: v${{ needs.setup.outputs.assembly_version }}
name: Release ${{ needs.setup.outputs.assembly_version }}
body: ${{ steps.build_changelog.outputs.changelog }}
artifacts: **/*.nupkg

- name: Tag git
uses: pkgdeps/[email protected]
Expand All @@ -188,7 +193,10 @@ jobs:
name: Publish to NuGet
if: needs.setup.outputs.should_publish == 'true'

needs: [setup, build, release]
needs:
- setup
- build
- release

runs-on: ubuntu-latest

Expand Down

0 comments on commit 62fa259

Please sign in to comment.