Skip to content

update main publish workflow #16

update main publish workflow

update main publish workflow #16

Workflow file for this run

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:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:

Check failure on line 20 in .github/workflows/main-publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main-publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 20
- 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@v1
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 "
- 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: Verify is based on origin/main to ensure PRs are correctly targeted
# List commits that are ahead of origin/Develop through HEAD and look for the tip of the current branch.
# If HEAD isn't ahead of origin/Develop, the git log bit will be empty and grep will fail
run: git log origin/main..HEAD | grep $(git rev-parse --short HEAD)
if: ${{ steps.detect_branch.outcome == 'failure' }}
- name: Pack
run: dotnet pack --configuration Release /p:Version=${{steps.get_version.outputs.RELEASE_VERSION}} --include-symbols --output .
if: ${{ steps.detect_branch.outcome == 'success' }}
- name: Push to Nuget
if: ${{ (steps.detect_branch.outcome == 'success' ) && ((github.event.inputs.PublishNuget == true) && (!contains(github.event.pull_request.title, 'no-publish'))) }}
# 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}}