Skip to content

Merge remote-tracking branch 'origin/feature/version-number-from-bran… #54

Merge remote-tracking branch 'origin/feature/version-number-from-bran…

Merge remote-tracking branch 'origin/feature/version-number-from-bran… #54

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main", "release/*", "feature/*", "bugfix/*" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Extract branch name if release
if: startsWith(github.ref, 'refs/heads/release')
shell: bash
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/release/}}" >> $GITHUB_ENV

Check failure on line 30 in .github/workflows/dotnet.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dotnet.yml

Invalid workflow file

You have an error in your yaml syntax on line 30
- name: Extract branch name if not release
if: !startsWith(github.ref, 'refs/heads/release')
shell: bash
run: echo "BRANCH=0.0.1" >> $GITHUB_ENV
id: extract_branch_version
- name: Build
run: dotnet build --no-restore -c Release /property:Version=${{ env.BRANCH }}
- name: Test
run: dotnet test --no-build --verbosity normal --filter "TestCategory!=Integration"
- name: Publish
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}