Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ jobs:
run: dotnet nuget add source ${{ github.workspace }}/nuget/local --name AggregateConfigBuildTask

- name: Restore IntegrationTests with custom AggregateConfigBuildTask package
run: dotnet restore test/IntegrationTests/IntegrationTests.csproj
run: dotnet restore test/IntegrationTests.sln

- name: Build IntegrationTests in Release mode
run: dotnet build test/IntegrationTests/IntegrationTests.csproj --configuration Release -warnaserror
run: dotnet build test/IntegrationTests.sln --configuration Release -warnaserror

- name: Run IntegrationTests
run: dotnet test test/IntegrationTests/IntegrationTests.csproj --configuration Release -warnaserror
run: dotnet test test/IntegrationTests.sln --configuration Release -warnaserror

- name: Upload integration results artifact
uses: actions/upload-artifact@v4
Expand Down
55 changes: 22 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Features

- Merge multiple YAML configuration files into a single output format (JSON, Azure ARM parameters, or YAML).
- Merge multiple configuration files into a single output format (JSON, Azure ARM parameters, or YAML).
- Support for injecting custom metadata (e.g., `ResourceGroup`, `Environment`) into the output.
- Optionally include the source file name in each configuration entry.
- Embed output files as resources in the assembly for easy inclusion in your project.
Expand All @@ -25,7 +25,10 @@ dotnet add package AggregateConfigBuildTask
Alternatively, add the following line to your `.csproj` file:

```xml
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0" />
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.1">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
</PackageReference>
```

## Usage
Expand All @@ -37,13 +40,6 @@ In your `.csproj` file, use the task to aggregate YAML files and output them in
```xml
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="AggregateConfigs" BeforeTargets="PrepareForBuild">
<ItemGroup>
<AdditionalProperty Include="ResourceGroup=TestRG" />
Expand All @@ -54,6 +50,7 @@ In your `.csproj` file, use the task to aggregate YAML files and output them in
InputDirectory="Configs"
OutputFile="$(MSBuildProjectDirectory)\out\output.json"
AddSourceProperty="true"
InputType="Yaml"
OutputType="Json"
AdditionalProperties="@(AdditionalProperty)" />
</Target>
Expand All @@ -74,13 +71,6 @@ You can also generate Azure ARM template parameters. Here's how to modify the co
```xml
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="AggregateConfigsForARM" BeforeTargets="PrepareForBuild">
<ItemGroup>
<AdditionalProperty Include="ResourceGroup=TestRG" />
Expand All @@ -90,7 +80,7 @@ You can also generate Azure ARM template parameters. Here's how to modify the co
<AggregateConfig
InputDirectory="Configs"
OutputFile="$(MSBuildProjectDirectory)\out\output.parameters.json"
OutputType="ArmParameter"
OutputType="Arm"
AdditionalProperties="@(AdditionalProperty)" />
</Target>

Expand All @@ -104,13 +94,6 @@ You can also output the aggregated configuration back into YAML format:
```xml
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="AggregateConfigsToYAML" BeforeTargets="PrepareForBuild">
<ItemGroup>
<AdditionalProperty Include="ResourceGroup=TestRG" />
Expand All @@ -134,13 +117,6 @@ You can embed the output files (such as the generated JSON) as resources in the
```xml
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="AggregateConfigs" BeforeTargets="PrepareForBuild">
<ItemGroup>
<AdditionalProperty Include="ResourceGroup=TestRG" />
Expand Down Expand Up @@ -173,8 +149,11 @@ In this example:
- **AddSourceProperty** *(optional, default=false)*: Adds a `source` property to each object in the output, indicating the YAML file it originated from.
- **OutputType** *(required)*: Determines the output format. Supported values:
- `Json`: Outputs a regular JSON file.
- `ArmParameter`: Outputs an Azure ARM template parameter file.
- `Arm`: Outputs an Azure ARM template parameter file.
- `Yaml`: Outputs a YAML file.
- **InputType** *(optional, default=YAML)*: Determines the input format. Supported values:
- `Json`: Inputs are JSON files with a `.json` extension.
- `Yaml`: Inputs are YAML files with a `.yml` or `.yaml` extension.
- **AdditionalProperties** *(optional)*: A collection of custom top-level properties to inject into the final output. Use the `ItemGroup` syntax to pass key-value pairs.

## Example YAML Input
Expand Down Expand Up @@ -256,7 +235,17 @@ resources:

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License. See the [LICENSE](https://github.com/richardsondev/AggregateConfigBuildTask/blob/main/LICENSE) file for details.

## Third-Party Libraries

This project leverages the following third-party libraries:

- **[YamlDotNet](https://github.com/aaubry/YamlDotNet)**
Used for YAML serialization and deserialization. YamlDotNet is distributed under the MIT License. For detailed information, refer to the [YamlDotNet License](https://github.com/aaubry/YamlDotNet/blob/master/LICENSE.txt).

- **[YamlDotNet.System.Text.Json](https://github.com/IvanJosipovic/YamlDotNet.System.Text.Json)**
Facilitates type handling for YAML serialization and deserialization, enhancing compatibility with System.Text.Json. This library is also distributed under the MIT License. For more details, see the [YamlDotNet.System.Text.Json License](https://github.com/IvanJosipovic/YamlDotNet.System.Text.Json/blob/main/LICENSE).

## Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ public enum OutputTypeEnum
{
Json,
Arm,
ArmParameter = Arm,
Yml,
Yaml = Yml
}

public enum InputTypeEnum
{
Json,
Yml,
Yaml = Yml
}
Expand Down
Loading