Skip to content

Commit

Permalink
add example workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
MattParkerDev committed Jul 7, 2024
1 parent 09a4fc5 commit 25299d4
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 24 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/example-prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Prod - Pipeline
on:
push:
branches:
- main
workflow_dispatch:

jobs:
call-reusable-build-and-deploy:
uses: ./.github/workflows/template-deploy.yml
with:
environment: 'prod'

secrets: inherit
39 changes: 39 additions & 0 deletions .github/workflows/example-template-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Template Build and Deploy
on:
workflow_call:
inputs:
# The environment to deploy to (Staging or Production)
environment:
required: true
type: string

secrets:
AZURECLIENTID:
required: true
AZURECLIENTSECRET:
required: true
AZURESUBSCRIPTIONID:
required: true
AZURETENANTID:
required: true

jobs:
execute-parallel-pipeline:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: azure/login@v2
with:
creds: '{"clientId":"${{ secrets.AZURECLIENTID }}","clientSecret":"${{ secrets.AZURECLIENTSECRET }}","subscriptionId":"${{ secrets.AZURESUBSCRIPTIONID }}","tenantId":"${{ secrets.AZURETENANTID }}"}'

- name: Set env
run: echo "ParallelPipelinesEnvironment=${{ inputs.environment }}" >> $GITHUB_ENV

- name: Dotnet Run Pipeline
run: dotnet run -c Release --project ./examplesrc/Example.Deploy/Example.Deploy.csproj ### Update to your new deploy project path
2 changes: 1 addition & 1 deletion ParallelPipelines.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examplesrc", "examplesrc", "{2C1B40FF-A8B7-42B4-994A-74E22076E0CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParallelPipelines.Console", "examplesrc\ParallelPipelines.Console\ParallelPipelines.Console.csproj", "{9A93959C-6425-4C82-9249-7A654E23DEB3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Deploy", "examplesrc\Example.Deploy\Example.Deploy.csproj", "{9A93959C-6425-4C82-9249-7A654E23DEB3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{48027F2A-A9FE-44D9-BD09-432A7E0B683F}"
EndProject
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using ParallelPipelines.Console.Steps._1Setup;
using ParallelPipelines.Console.Steps._2ProvisionAzureResources;
using ParallelPipelines.Console.Steps._3BuildAndPublish;
using ParallelPipelines.Console.Steps._4Deploy;
using Example.Deploy.Steps._1Setup;
using Example.Deploy.Steps._2ProvisionAzureResources;
using Example.Deploy.Steps._3BuildAndPublish;
using Example.Deploy.Steps._4Deploy;
using ParallelPipelines.Host;

var builder = Host.CreateApplicationBuilder(args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._1Setup;
namespace Example.Deploy.Steps._1Setup;

public class InstallDotnetWasmToolsStep(IPipelineContext pipelineContext) : IStep
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._1Setup;
namespace Example.Deploy.Steps._1Setup;

public class InstallSwaCliStep(IPipelineContext pipelineContext) : IStep
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._2ProvisionAzureResources;
namespace Example.Deploy.Steps._2ProvisionAzureResources;

public class CreateResourceGroupStep(IPipelineContext pipelineContext) : IStep
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._2ProvisionAzureResources;
namespace Example.Deploy.Steps._2ProvisionAzureResources;

[DependsOnStep<CreateResourceGroupStep>]
public class DeployBicepStep(IPipelineContext pipelineContext) : IStep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._3BuildAndPublish;
namespace Example.Deploy.Steps._3BuildAndPublish;

[DependsOnStep<RestoreAndBuildStep>]
public class PublishWebApiStep(IPipelineContext pipelineContext) : IStep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ParallelPipelines.Console.Steps._1Setup;
using Example.Deploy.Steps._1Setup;
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._3BuildAndPublish;
namespace Example.Deploy.Steps._3BuildAndPublish;

[DependsOnStep<RestoreAndBuildStep>]
[DependsOnStep<InstallDotnetWasmToolsStep>]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ParallelPipelines.Console.Steps._1Setup;
using Example.Deploy.Steps._1Setup;
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._3BuildAndPublish;
namespace Example.Deploy.Steps._3BuildAndPublish;

[DependsOnStep<InstallDotnetWasmToolsStep>]
public class RestoreAndBuildStep(IPipelineContext pipelineContext) : IStep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using ParallelPipelines.Console.Steps._2ProvisionAzureResources;
using ParallelPipelines.Console.Steps._3BuildAndPublish;
using Example.Deploy.Steps._2ProvisionAzureResources;
using Example.Deploy.Steps._3BuildAndPublish;
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._4Deploy;
namespace Example.Deploy.Steps._4Deploy;

[DependsOnStep<PublishWebApiStep>]
[DependsOnStep<DeployBicepStep>]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using ParallelPipelines.Console.Steps._1Setup;
using ParallelPipelines.Console.Steps._2ProvisionAzureResources;
using ParallelPipelines.Console.Steps._3BuildAndPublish;
using Example.Deploy.Steps._1Setup;
using Example.Deploy.Steps._2ProvisionAzureResources;
using Example.Deploy.Steps._3BuildAndPublish;
using ParallelPipelines.Domain.Entities;

namespace ParallelPipelines.Console.Steps._4Deploy;
namespace Example.Deploy.Steps._4Deploy;

[DependsOnStep<InstallSwaCliStep>]
[DependsOnStep<DeployBicepStep>]
Expand Down
2 changes: 1 addition & 1 deletion src/ParallelPipelines/Host/Helpers/PipelineFileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace ParallelPipelines.Host.Helpers;

public static class PipelineFileHelper
{
public static DirectoryInfo GitRootDirectory { get; set; } = null!;
public static DirectoryInfo GitRootDirectory { get; private set; } = null!;

internal static async Task PopulateGitRootDirectory(CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using ParallelPipelines.Console.Steps._1Setup;
using Example.Deploy.Steps._1Setup;
using ParallelPipelines.Domain.Enums;
using ParallelPipelines.Host;
using ParallelPipelines.Host.Services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\examplesrc\ParallelPipelines.Console\ParallelPipelines.Console.csproj" />
<ProjectReference Include="..\..\examplesrc\Example.Deploy\Example.Deploy.csproj" />
<ProjectReference Include="..\..\src\ParallelPipelines\ParallelPipelines.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 25299d4

Please sign in to comment.