Skip to content

releases

releases #2

Workflow file for this run

name: releases
on:
workflow_dispatch:
env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry
DOTNET_VERSION: '8.0'
CSPROJ_FILE_PATH: 'src/Serilog.Sinks.SQLite/Serilog.Sinks.SQLite.csproj'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Install .NET SDK
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '${{ env.DOTNET_VERSION }}.x'
# Restore Dependencies
- name: Restore Dependencies
run: dotnet restore ${{ env.CSPROJ_FILE_PATH }}
# Get the commit count and format the version
- name: Get commit count and format version
id: version
shell: bash
run: |
commit_count=$(git rev-list --count HEAD)
major=$((commit_count / 100 + 1))
minor=$((commit_count % 100 / 10))
patch=$((commit_count % 10))
formatted_version="$major.$minor.$patch"
echo "VERSION=$formatted_version" >> $GITHUB_ENV
- name: Build
run: dotnet build ${{ env.CSPROJ_FILE_PATH }} --configuration Release --no-restore
- name: Pack
run: dotnet pack ${{ env.CSPROJ_FILE_PATH }} -p:PackageVersion=${{ env.VERSION }} -c:Release --no-build --output nupkgs
- name: Push NuGet Package
shell: bash
run: dotnet nuget push nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}