Merge pull request #19 from calebjenkins/develop #26
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
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths-ignore: | ||
- '**.md' | ||
workflow_dispatch: | ||
inputs: | ||
PublishNuget: | ||
type: boolean | ||
description: Publish to nuget - defaults to true, but can be false for non-publishing scenarios. | ||
default: true | ||
jobs: | ||
build: | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '7.0.x' | ||
- name: Package Restore | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --configuration Release | ||
- name: Test | ||
#run: dotnet test --configuration Release --no-build | ||
run: dotnet test --configuration Release --no-build --filter 'FullyQualifiedName!~BDD_Specs' | ||
#- name: Run SpecFlow Tests | ||
# uses: cryptic-wizard/run-specflow-tests@v1.3.1 | ||
# with: | ||
# test-assembly-path: src/BDD/BDD_Specs/BDD_Specs/bin/Release/net6.0 | ||
# test-assembly-dll: BDD_Specs.dll | ||
# output-html: BDD_SpecResults.html | ||
# no-build: true | ||
# upload-artifact: true | ||
- name: Echo Branch Name | ||
run: echo "Branch name is $GITHUB_REF_NAME " | ||
#if: ${{ github.ref == 'refs/heads/main' }} | ||
- name: Get version | ||
id: get_version | ||
uses: greenygh0st/net-proj-release-version@v2 | ||
with: | ||
# Filepath of the *.csproj file, relative to root of repository | ||
PROJ_FILE: src/Extensions/Extensions.csproj | ||
# env: | ||
# RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }} | ||
- name: Show Release Version | ||
run: echo "Release Version is ${{steps.get_version.outputs.RELEASE_VERSION}}" | ||
- name: Set Release Version | ||
run: echo "getting version" | ||
env: | ||
RELEASE_VERSION: steps.get_version.outputs.RELEASE_VERSION | ||
#- name: Show Release Version | ||
# run: echo "Release Version is ${{steps.get_version.outputs.RELEASE_VERSION}}" | ||
- name: Print new build number | ||
run: echo "Build number is $GITHUB_RUN_NUMBER " | ||
# workflow_dispatch pull_request push | ||
- name: Print Triggering Event | ||
run: echo ${{ github.event_name }} | ||
- name: Detect if workflow is running on origin/main | ||
id: detect_branch | ||
run: git rev-parse HEAD | grep $(git rev-parse origin/main) | ||
continue-on-error: true | ||
- name: Pack | ||
run: dotnet pack --configuration Release /p:Version=${{steps.get_version.outputs.RELEASE_VERSION}} --include-symbols --output . | ||
if: ${{ steps.detect_branch.outcome == 'success' }} | ||
# workflow_dispatch pull_request push | ||
- name: Push to Nuget | ||
if: ( github.event_name == 'workflow_dispatch' && github.event.inputs.PublishNuget == 'true') || ( github.event_name == 'pull_request' && (!contains(github.event.pull_request.title, 'no-publish')) | ||
Check failure on line 98 in .github/workflows/main-publish.yml
|
||
# if: ${{ (github.ref == 'refs/heads/main') && ((github.event.inputs.PublishNuget == true) && (!contains(github.event.pull_request.title, 'no-publish'))) }} | ||
# if: ${{ steps.detect_branch.outcome == 'success' }} | ||
# if: ${{ github.event.inputs.PublishNuget == 'true'}} | ||
# run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}} | ||
run: dotnet nuget push Calebs.Extensions.${{steps.get_version.outputs.RELEASE_VERSION}}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_KEY}} | ||