Merge pull request #490 from nhart12/dev #55
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
name: Release | |
on: | |
push: | |
branches: [ dev, main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run build | |
run: ./Build.ps1 -SkipTests | |
- name: Read version from csproj | |
run: | | |
$selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '<VersionPrefix>(.+)</VersionPrefix>' | |
$versionMatch = $selectResult.Matches[0].Groups[1].Value | |
echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV | |
echo "Found version $versionMatch" | |
- name: Create GitHub release | |
if: ${{ github.ref_name == 'main' }} | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
automatic_release_tag: "v${{ env.VERSION }}" | |
title: "v${{ env.VERSION }}" | |
files: | | |
artifacts/*.nupkg | |
artifacts/*.snupkg | |
- name: Publish to nuget.org | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: nuget push artifacts\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{ env.NUGET_API_KEY }} |