Skip publish in release for pull requests

This commit is contained in:
Peter Butzhammer
2024-02-07 11:05:26 +01:00
parent 8aaf3c1e7e
commit 1b7a85c7c5
2 changed files with 5 additions and 3 deletions

42
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Release
on:
push:
branches:
- master
pull_request:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Install NUnit.ConsoleRunner
run: nuget install NUnit.ConsoleRunner -Version 3.13.0 -DirectDownload -OutputDirectory .
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore /p:version=1.1.${{ github.run_number }}
- name: Tests
run: ./NUnit.ConsoleRunner.3.13.0/tools/nunit3-console.exe "Sharp7.Rx.Tests\bin\Release\net461\Sharp7.Rx.Tests.dll"
- name: NugetPublish
run: dotnet nuget push Sharp7.Rx\bin\Release\Sharp7.Rx.1.1.${{ github.run_number }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}
if: github.event_name != 'pull_request'
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 1.1.${{ github.run_number }}
release_name: 1.1.${{ github.run_number }}
draft: false
prerelease: true
if: github.event_name != 'pull_request'