Skip to content

Commit

Permalink
Adding additional workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Jun 29, 2020
1 parent 2bb14e9 commit f867b50
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
push:
branches:
- master
- release-*
tags:
- '*.*.*'
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
runs-on: windows-latest
runs-on: windowws-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,9 +20,10 @@ jobs:
- name: Build and Test
run: ./Build.ps1
shell: pwsh
- name: Push
- name: Push to MyGet
env:
MYGET_MEDIATR_CI_API_KEY: ${{ secrets.MYGET_MEDIATR_CI_API_KEY }}
NUGET_URL: https://www.myget.org/F/mediatr-ci/api/v3/index.json
NUGET_API_KEY: ${{ secrets.MYGET_MEDIATR_CI_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Artifacts
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR

on:
pull_request:

jobs:
build:

runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build and Test
run: ./Build.ps1
shell: pwsh
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
tags:
- '*.*.*'
jobs:
build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build and Test
run: ./Build.ps1
shell: pwsh
- name: Push to MyGet
env:
NUGET_URL: https://www.myget.org/F/mediatr-ci/api/v3/index.json
NUGET_API_KEY: ${{ secrets.MYGET_MEDIATR_CI_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Push to NuGet
env:
NUGET_URL: https://api.nuget.org/v3/index.json
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: ./Push.ps1
shell: pwsh
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/**/*
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Project>
<PropertyGroup>
<Authors>Jimmy Bogard</Authors>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions MediatR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6267E2ED-942C-497D-BFC9-B3CE0AFC276F}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{962C5ACA-AB2B-4E9B-9EBB-7E7EE28CDBB1}"
EndProject
Expand Down Expand Up @@ -37,8 +40,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Build.ps1 = Build.ps1
.github\workflows\ci.yml = .github\workflows\ci.yml
Directory.Build.props = Directory.Build.props
.github\workflows\pr.yml = .github\workflows\pr.yml
Push.ps1 = Push.ps1
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediatR.Examples.Unity", "samples\MediatR.Examples.Unity\MediatR.Examples.Unity.csproj", "{E6C51E44-59B4-4F4F-AFB3-4032CDDEF07A}"
Expand Down
6 changes: 3 additions & 3 deletions Push.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
$scriptName = $MyInvocation.MyCommand.Name
$artifacts = "./artifacts"

if ([string]::IsNullOrEmpty($Env:MYGET_MEDIATR_CI_API_KEY)) {
Write-Host "${scriptName}: MYGET_MEDIATR_CI_API_KEY is empty or not set. Skipped pushing package(s)."
if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
} else {
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
Write-Host "$($scriptName): Pushing $($_.Name)"
dotnet nuget push $_ --source https://www.myget.org/F/mediatr-ci/api/v3/index.json --api-key $Env:MYGET_MEDIATR_CI_API_KEY
dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
Expand Down
15 changes: 15 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<Authors>Jimmy Bogard</Authors>
<Copyright>Jimmy Bogard</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">True</ContinuousIntegrationBuild>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
</Project>

0 comments on commit f867b50

Please sign in to comment.