Skip to content

build pipeline: build all tags #11

build pipeline: build all tags

build pipeline: build all tags #11

Workflow file for this run

name: Build, Test, Publish
on:
push:
branches: [ main ]
paths-ignore:
- "*.md"
- "*.png"
- "*.drawio"
- ".gitignore"
tags:
- '*'
pull_request:
branches: [ main ]
paths-ignore:
- "*.md"
- "*.png"
- "*.drawio"
- ".gitignore"
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- id: set-version
name: Set Version
run: |
ref=${{ github.ref }}
pattern="^refs/tags/[0-9]+.[0-9]+.[0-9]+(-.*)$"
if [[ $ref =~ $pattern ]]; then
is_release=true
else
is_release=false
fi
echo "IS_RELEASE=$is_release" >> $GITHUB_ENV
if $IS_RELEASE == true; then
version=$(echo $ref | cut -c 11-)
else
version="0.0.1-build$(date +'%Y%m%d'-'%H%M%S')"
fi
echo "VERSION=$version" >> $GITHUB_ENV
- id: print-version
name: Print Version
run: |
echo "is release: ${{ env.IS_RELEASE }}"
echo "version: ${{ env.VERSION }}"
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore EventBrokerSlim.sln
- name: Build
run: dotnet build EventBrokerSlim.sln --no-restore --configuration Release -p:Version=${{ env.VERSION }}
- name: Run Unit Tests
run: dotnet test test/M.EventBrokerSlim.Tests/M.EventBrokerSlim.Tests.csproj --no-build --no-restore --verbosity normal --configuration Release --logger trx --collect:"XPlat Code Coverage" --results-directory testresults
- name: Unit Tests Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Tests Report
path: testresults/*.trx
reporter: dotnet-trx
- name: Create NuGet Package
if: ${{ success() && env.IS_RELEASE == 'true' }}
run: dotnet pack src/M.EventBrokerSlim/M.EventBrokerSlim.csproj -p:PackageVersion=${{ env.VERSION }} --output ./ --configuration Release --no-restore --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Publish NuGet Package
if: ${{ success() && env.IS_RELEASE == 'true' }}
# run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API }} -s https://api.nuget.org/v3/index.json
run: |
echo "ulpoading package"