Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Adding all the github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Jun 30, 2020
1 parent 53e29f6 commit 008bfb2
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ on:
push:
branches:
- master
- release-*
tags:
- '*.*.*'
pull_request:
branches:
- master
jobs:
build:
strategy:
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: windows-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/**/*
2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ exec { & dotnet build -c Release }

exec { & dotnet test -c Release -r $artifacts --no-build -l trx --verbosity=normal }

exec { dotnet pack .\src\MediatR.Extensions.Microsoft.DependencyInjection -c Release -o $artifacts --include-symbols -p:SymbolPackageFormat=snupkg --no-build }
exec { dotnet pack .\src\MediatR.Extensions.Microsoft.DependencyInjection -c Release -o $artifacts --no-build }
2 changes: 2 additions & 0 deletions MediatR.DI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{1082ED20
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.Extensions.Microsoft.DependencyInjection", "src\MediatR.Extensions.Microsoft.DependencyInjection\MediatR.Extensions.Microsoft.DependencyInjection.csproj", "{CD3BCC44-44C0-4A5A-9041-34B558A9FBF2}"
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 ($Env:MYGET_MEDIATR_CI_API_KEY -eq $null) {
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
<AssemblyName>MediatR.Extensions.Microsoft.DependencyInjection</AssemblyName>
<PackageId>MediatR.Extensions.Microsoft.DependencyInjection</PackageId>
<PackageTags>mediator;request;response;queries;commands;notifications</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/jbogard/MediatR/master/assets/logo/gradient_128x128.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection</RepositoryUrl>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\MediatR.snk</AssemblyOriginatorKeyFile>
<PackageIcon>gradient_128x128.png</PackageIcon>

<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>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,10 +27,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
<PackageReference Include="MediatR" Version="8.0.0" />
<PackageReference Include="MinVer" Version="2.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.3.0" PrivateAssets="All" />
</ItemGroup>

</Project>

0 comments on commit 008bfb2

Please sign in to comment.