From a2d6811c5b786b1d589b2b2088768b178ff09917 Mon Sep 17 00:00:00 2001 From: Antoine Aubry Date: Sat, 27 Mar 2021 19:16:05 +0000 Subject: [PATCH] Add job to create a new release Release notes are no longer stored in the repository. --- .github/workflows/create-release.yml | 28 +++++ RELEASE_NOTES.md | 56 --------- releases/2.0.0.md | 12 -- releases/2.1.0.md | 4 - releases/2.2.0.md | 4 - releases/3.0.0.md | 10 -- releases/3.1.0.md | 4 - releases/3.1.1.md | 4 - releases/3.2.0.md | 11 -- releases/3.2.1.md | 4 - releases/3.3.0.md | 4 - releases/3.3.1.md | 4 - releases/3.4.0.md | 8 -- releases/3.5.0.md | 9 -- releases/3.5.1.md | 6 - releases/3.6.0.md | 13 -- releases/3.6.1.md | 6 - releases/3.7.0.md | 4 - releases/3.8.0.md | 20 ---- releases/3.9.0.md | 19 --- releases/4.0.0.md | 59 --------- releases/4.1.0.md | 35 ------ releases/4.2.0.md | 16 --- releases/4.2.1.md | 7 -- releases/4.2.2.md | 6 - releases/4.2.3.md | 8 -- releases/4.2.4.md | 13 -- releases/4.3.0.md | 4 - releases/4.3.1.md | 4 - releases/4.3.2.md | 7 -- releases/5.0.0.md | 37 ------ releases/5.1.0.md | 8 -- releases/5.2.0.md | 5 - releases/5.2.1.md | 5 - releases/5.3.0.md | 9 -- releases/5.3.1.md | 5 - releases/5.4.0.md | 7 -- releases/6.0.0.md | 11 -- releases/6.1.1.md | 23 ---- releases/6.1.2.md | 30 ----- releases/7.0.0.md | 48 -------- releases/8.0.0.md | 23 ---- releases/8.1.0.md | 12 -- releases/8.1.1.md | 13 -- releases/8.1.2.md | 6 - releases/9.1.0.md | 16 --- releases/9.1.1.md | 5 - releases/9.1.2.md | 5 - releases/9.1.3.md | 4 - releases/9.1.4.md | 3 - tools/build/BuildDefinition.cs | 172 +++++++++++++-------------- tools/build/GitHubApiModels.cs | 10 ++ tools/build/Program.cs | 44 +++++-- tools/build/build.csproj | 1 + 54 files changed, 154 insertions(+), 737 deletions(-) create mode 100644 .github/workflows/create-release.yml delete mode 100644 RELEASE_NOTES.md delete mode 100644 releases/2.0.0.md delete mode 100644 releases/2.1.0.md delete mode 100644 releases/2.2.0.md delete mode 100644 releases/3.0.0.md delete mode 100644 releases/3.1.0.md delete mode 100644 releases/3.1.1.md delete mode 100644 releases/3.2.0.md delete mode 100644 releases/3.2.1.md delete mode 100644 releases/3.3.0.md delete mode 100644 releases/3.3.1.md delete mode 100644 releases/3.4.0.md delete mode 100644 releases/3.5.0.md delete mode 100644 releases/3.5.1.md delete mode 100644 releases/3.6.0.md delete mode 100644 releases/3.6.1.md delete mode 100644 releases/3.7.0.md delete mode 100644 releases/3.8.0.md delete mode 100644 releases/3.9.0.md delete mode 100644 releases/4.0.0.md delete mode 100644 releases/4.1.0.md delete mode 100644 releases/4.2.0.md delete mode 100644 releases/4.2.1.md delete mode 100644 releases/4.2.2.md delete mode 100644 releases/4.2.3.md delete mode 100644 releases/4.2.4.md delete mode 100644 releases/4.3.0.md delete mode 100644 releases/4.3.1.md delete mode 100644 releases/4.3.2.md delete mode 100644 releases/5.0.0.md delete mode 100644 releases/5.1.0.md delete mode 100644 releases/5.2.0.md delete mode 100644 releases/5.2.1.md delete mode 100644 releases/5.3.0.md delete mode 100644 releases/5.3.1.md delete mode 100644 releases/5.4.0.md delete mode 100644 releases/6.0.0.md delete mode 100644 releases/6.1.1.md delete mode 100644 releases/6.1.2.md delete mode 100644 releases/7.0.0.md delete mode 100644 releases/8.0.0.md delete mode 100644 releases/8.1.0.md delete mode 100644 releases/8.1.1.md delete mode 100644 releases/8.1.2.md delete mode 100644 releases/9.1.0.md delete mode 100644 releases/9.1.1.md delete mode 100644 releases/9.1.2.md delete mode 100644 releases/9.1.3.md delete mode 100644 releases/9.1.4.md create mode 100644 tools/build/GitHubApiModels.cs diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 000000000..b94ca719c --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,28 @@ +name: Create a new release +on: + workflow_dispatch: + inputs: + ref: + description: Commit name to release (defaults to master) + required: false + +jobs: + release: + name: Draft Release + runs-on: ubuntu-latest + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.ref }} + + - name: Install GitVersion.Tool + run: dotnet tool install --global GitVersion.Tool + + - name: Create draft release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./build.sh CreateGithubRelease diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md deleted file mode 100644 index 184c570bf..000000000 --- a/RELEASE_NOTES.md +++ /dev/null @@ -1,56 +0,0 @@ -# Release notes - -## Release 9.1.4 - -- Fix LookAheadBuffer trying to read from the stream after reaching its end - - -# Previous releases - -- [9.1.3](releases/9.1.3.md) -- [9.1.2](releases/9.1.2.md) -- [9.1.1](releases/9.1.1.md) -- [9.1.0](releases/9.1.0.md) -- [8.1.2](releases/8.1.2.md) -- [8.1.1](releases/8.1.1.md) -- [8.1.0](releases/8.1.0.md) -- [8.0.0](releases/8.0.0.md) -- [7.0.0](releases/7.0.0.md) -- [6.1.2](releases/6.1.2.md) -- [6.1.1](releases/6.1.1.md) -- [6.0.0](releases/6.0.0.md) -- [5.4.0](releases/5.4.0.md) -- [5.3.1](releases/5.3.1.md) -- [5.3.0](releases/5.3.0.md) -- [5.2.1](releases/5.2.1.md) -- [5.2.0](releases/5.2.0.md) -- [5.1.0](releases/5.1.0.md) -- [5.0.0](releases/5.0.0.md) -- [4.3.2](releases/4.3.2.md) -- [4.3.1](releases/4.3.1.md) -- [4.3.0](releases/4.3.0.md) -- [4.2.4](releases/4.2.4.md) -- [4.2.3](releases/4.2.3.md) -- [4.2.2](releases/4.2.2.md) -- [4.2.1](releases/4.2.1.md) -- [4.2.0](releases/4.2.0.md) -- [4.1.0](releases/4.1.0.md) -- [4.0.0](releases/4.0.0.md) -- [3.9.0](releases/3.9.0.md) -- [3.8.0](releases/3.8.0.md) -- [3.7.0](releases/3.7.0.md) -- [3.6.1](releases/3.6.1.md) -- [3.6.0](releases/3.6.0.md) -- [3.5.1](releases/3.5.1.md) -- [3.5.0](releases/3.5.0.md) -- [3.4.0](releases/3.4.0.md) -- [3.3.1](releases/3.3.1.md) -- [3.3.0](releases/3.3.0.md) -- [3.2.1](releases/3.2.1.md) -- [3.2.0](releases/3.2.0.md) -- [3.1.1](releases/3.1.1.md) -- [3.1.0](releases/3.1.0.md) -- [3.0.0](releases/3.0.0.md) -- [2.2.0](releases/2.2.0.md) -- [2.1.0](releases/2.1.0.md) -- [2.0.0](releases/2.0.0.md) \ No newline at end of file diff --git a/releases/2.0.0.md b/releases/2.0.0.md deleted file mode 100644 index 8a8725ca2..000000000 --- a/releases/2.0.0.md +++ /dev/null @@ -1,12 +0,0 @@ -# Release 2.0.0 - -* YamlSerializer has been replaced by the Deserializer class. It offer the same functionality of YamlSerializer but is easier to maintain and extend. - * **Breaking change:** DeserializationOverrides is no longer supported. If you need this, please file a bug and we will analyze it. - * **Breaking change:** IDeserializationContext is no longer supported. If you need this, please file a bug and we will analyze it. - * Tag mappings are registered directly on the Deserializer using RegisterTagMapping() - * ObjectFactory is specified in the constructor, if required. - -* Bug fixes to the Serializer: - * Fix bug when serializing lists with nulls inside. e9019d5f224f266e88d9882502f83f0c6865ec24 - -* Adds a YAML editor add-in for Visual Studio 2012. Available on the [Visual Studio Gallery](http://visualstudiogallery.msdn.microsoft.com/34423c06-f756-4721-8394-bc3d23b91ca7). diff --git a/releases/2.1.0.md b/releases/2.1.0.md deleted file mode 100644 index e03428840..000000000 --- a/releases/2.1.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 2.1.0 - -TODO - diff --git a/releases/2.2.0.md b/releases/2.2.0.md deleted file mode 100644 index 509540201..000000000 --- a/releases/2.2.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 2.2.0 - -TODO - diff --git a/releases/3.0.0.md b/releases/3.0.0.md deleted file mode 100644 index 619d6a60b..000000000 --- a/releases/3.0.0.md +++ /dev/null @@ -1,10 +0,0 @@ -# Release 3.0.0 - -* Fix issue #26: Use the actual type of the objects instead of the statically detected one. -* Merged the Core, Converters and RepresentationModel assemblies. **The NuGet packages YamlDotNet.Core and YamlDotNet.RepresentationModel are now a single package, named YamlDotNet**. -* Removed YamlDotNet.Configuration and YamlDotNet.Converters. -* Line numbers in error messages now start at one. -* TypeConverter is now used to cast list items. -* Various code improvements. -* More and better unit tests. - diff --git a/releases/3.1.0.md b/releases/3.1.0.md deleted file mode 100644 index 6e39cda12..000000000 --- a/releases/3.1.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.1.0 - -* Add a parameter to the deserializer to ignore unmapped properties in YAML. - diff --git a/releases/3.1.1.md b/releases/3.1.1.md deleted file mode 100644 index dc76c4efa..000000000 --- a/releases/3.1.1.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.1.1 - -This is a bugfix release that fixes issue #90. - diff --git a/releases/3.2.0.md b/releases/3.2.0.md deleted file mode 100644 index 14c0aaec2..000000000 --- a/releases/3.2.0.md +++ /dev/null @@ -1,11 +0,0 @@ -# Release 3.2.0 - -This release adds merge key support: http://yaml.org/type/merge.html - -Example from BackreferencesAreMergedWithMappings unit test: - -```C# -var reader = new EventReader(new MergingParser(new Parser(stream))); -var result = Deserializer.Deserialize>>(parser); -``` - diff --git a/releases/3.2.1.md b/releases/3.2.1.md deleted file mode 100644 index ac9c0436f..000000000 --- a/releases/3.2.1.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.2.1 - -* Fix AnchorNotFoundException when another exception occurs during deserialization. - diff --git a/releases/3.3.0.md b/releases/3.3.0.md deleted file mode 100644 index f4f129e3d..000000000 --- a/releases/3.3.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.3.0 - -* Make types in YamlDotNet.RepresentationModel serializable. - diff --git a/releases/3.3.1.md b/releases/3.3.1.md deleted file mode 100644 index d8540ef19..000000000 --- a/releases/3.3.1.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.3.1 - -This release adds a signed package and portable versions of the library. - diff --git a/releases/3.4.0.md b/releases/3.4.0.md deleted file mode 100644 index 4b4cdaeb1..000000000 --- a/releases/3.4.0.md +++ /dev/null @@ -1,8 +0,0 @@ -# Release 3.4.0 - -Changes and fixes on the Scanner to make it more usable: - -* Report the location of comments correctly, when the scanner is created with "skipComments = false" -* In case of syntax error, do not report an empty range and skip to the next token. -* Make the scanner and related types serializable, so that the state of the scanner can be captured and then restored later (assuming that the TextReader is also serializable). - diff --git a/releases/3.5.0.md b/releases/3.5.0.md deleted file mode 100644 index 2082a7338..000000000 --- a/releases/3.5.0.md +++ /dev/null @@ -1,9 +0,0 @@ -# Release 3.5.0 - -* Add native support of System.Guid serialization. -* Add properties to YamlMemberAttribute: - * Order: specifies the order of the members when they are serialized. - * Alias: instructs the deserializer to use a different field name for serialization. -* The YamlAliasAttribute is now obsolete. New code should use YamlMemberAttribute instead. -* Throw proper exceptions, with correct marks, when deserialization of a node fails. - diff --git a/releases/3.5.1.md b/releases/3.5.1.md deleted file mode 100644 index cfc7ad15f..000000000 --- a/releases/3.5.1.md +++ /dev/null @@ -1,6 +0,0 @@ -# Release 3.5.1 - -Fix bug: - -* Scalars returned by the scanner do not have their Start and End properties set. - diff --git a/releases/3.6.0.md b/releases/3.6.0.md deleted file mode 100644 index af9f2ebca..000000000 --- a/releases/3.6.0.md +++ /dev/null @@ -1,13 +0,0 @@ -# Release 3.6.0 - -New features: - - * Ability to opt out of anchor assignment during `YamlStream.Save()`. - * Allow the style of scalar properties to be specified through the `YamlMember` attribute. - * Add solution configuration to target "Unity 3.5 .net Subset Base Class Libraries". - -Bug fixes: - - * Do not compare nodes by value while assigning anchors. It is the responsibility of the user to use the same reference if they want an alias. - * Fixed #121: Finding properties in parent interfaces - diff --git a/releases/3.6.1.md b/releases/3.6.1.md deleted file mode 100644 index 8224d5038..000000000 --- a/releases/3.6.1.md +++ /dev/null @@ -1,6 +0,0 @@ -# Release 3.6.1 - -Bug fixes: - - * Bug in the GetPublicMethods implementation for portable. - diff --git a/releases/3.7.0.md b/releases/3.7.0.md deleted file mode 100644 index 976b2f70e..000000000 --- a/releases/3.7.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 3.7.0 - -This is a minor update that simply adds an overload of YamlStream.Load to be able to specify the EventReader. - diff --git a/releases/3.8.0.md b/releases/3.8.0.md deleted file mode 100644 index 25c43cb50..000000000 --- a/releases/3.8.0.md +++ /dev/null @@ -1,20 +0,0 @@ -# Release 3.8.0 - -New features: - -* **Add support for different scalar integer bases.** - Addresses issue [#113](https://github.com/aaubry/YamlDotNet/issues/113). Adds basic support for deserializing scalar integers - written in binary, octal, decimal, hex, and base 60, as allowed in the YAML - specification; see http://yaml.org/type/int.html. Adds unit tests for each - of these bases as well. -* **Add dnx compatibility to the NuGet packages.** -* Do not throw exception if a tag does not contain a valid type name. - -Fixes and improvements: - -* Cache type metadata. -* Fix wrong type when deserializing UInt16. -* Fix handling of special float values, such as NaN, PositiveInfinity and NegativeInfinity. -* Properly quote empty strings. -* Properly handle non-Unicode encodings when emitting scalars. - diff --git a/releases/3.9.0.md b/releases/3.9.0.md deleted file mode 100644 index e5193645b..000000000 --- a/releases/3.9.0.md +++ /dev/null @@ -1,19 +0,0 @@ -# Release 3.9.0 - -New features: - -* Add YamlVisitorBase as an improved replacement for YamlVisitor - * **YamlVisitor is now obsolete**, and will be removed in a future release. -* Ensure compatibility with AOT compilation, for platforms that do not allow dynamic code generation, such as IOS or PS4. -* Add Yaml attribute overrides feature, similar to XML Serializer attribute overrides behavior. -* Add a YamlNodeType enumeration property to nodes. - -Bug fixes: - -* Fix #166 - Guid conversion to JSON is unquoted. -* Ignore enum value case during deserialization. -* Improve newline handling - * In some cases, consecutive newlines were incorrectly parsed or emitted. -* Fix #177 - double.MaxValue serialization. -* Register custom type converters with higher precedence than the built-in converters. - diff --git a/releases/4.0.0.md b/releases/4.0.0.md deleted file mode 100644 index 9f095b50e..000000000 --- a/releases/4.0.0.md +++ /dev/null @@ -1,59 +0,0 @@ -# Release 4.0.0 - -This a major release that introduces a few breaking changes. - -## Breaking changes - -* **The constructors of `Serializer` and `Deserializer` are now obsolete** - Except for the parameterless versions. The `SerializerBuilder` and `DeserializerBuilder` - classes should now be used to configure and create instances of the (de)serializer. - -* **Replaced the `IYamlSerializable` interface with `IYamlConvertible`** - The `IYamlSerializable` is now obsolete, but will be kept until the next major release. - -* **[Removed](https://github.com/aaubry/YamlDotNet/pull/203) `EventReader`** - `EventReader` was a wrapper over `IParser` that offered some abstractions for parsing, - but also had some design flaws. It has been replaced by extension methods for `IParser`. - The extension methods provide the same functionality, - and allow to always use the same type to represent the parser. - -* **Dropped support for `YamlAliasAttribute`** - This class has been obsolete for many releases, and it was time to let it go. - -## New features - -* [**`SerializerBuilder` and `DeserializerBuilder`**](https://github.com/aaubry/YamlDotNet/pull/204) - This is an important change that adds "builders" that can be used - to configure the Serializer and Deserializer through a fluent syntax. - The main objective of this is to allow more control over - the composition of services performed by these two classes. - This means that every aspect of the composition should be - extensible / overridable. Things like injecting a custom TypeInspector - or replacing the default ArrayNodeDeserializer with - an alternative implementation become possible and easy. - In order to avoid breaking existing code, - the constructors of Serializer and Deserializer have been kept - but marked as obsolete. In a future release they will be discarded. - -* **Added the `IYamlConvertible` interface** - This new interface differs in that its methods receive a delegate that can be used - to reuse the current serializer or deserializer. - -* **Improved the usability of `YamlDocument`** - and other RepresentationModel classes: - * Added conversion operators and indexers for easier parsing and construction of YamlNodes. - * `YamlMappingNode`, `YamlSequenceNode` and `YamlScalarNode` now implement `IYamlConvertible`, - which means that these types can appear in the middle of an object that is being serialized or - deserialized, and produce the expected result. - -* [**Added support for alternative Boolean values**](https://github.com/aaubry/YamlDotNet/pull/183) - * True: `true`, `y`, `yes`, `on` - * False: `false`, `n`, `no`, `off`. - - -## Bug fixes - -* [Serialization Error when string starts with quote](https://github.com/aaubry/YamlDotNet/issues/135) -* [YamlVisitor is marked as obsolete, but no YamlVisitorBase class exists](https://github.com/aaubry/YamlDotNet/issues/200) -* Do not assign anchors to scalars during serialization. - diff --git a/releases/4.1.0.md b/releases/4.1.0.md deleted file mode 100644 index 89869a2fa..000000000 --- a/releases/4.1.0.md +++ /dev/null @@ -1,35 +0,0 @@ -# Release 4.1.0 - -## New features - -* 32bits Unicode code points in escape sequences and url-encoded tags [are now properly handled](https://github.com/aaubry/YamlDotNet/pull/219). -* [Anchors can now be redefined](https://github.com/aaubry/YamlDotNet/pull/222) in a document. - This is to conform to [the 1.1 spec](http://yaml.org/spec/1.1/#id863390) as well as [the 1.2 spec](http://www.yaml.org/spec/1.2/spec.html#id2765878): - - > ### 3.2.2.2. Anchors and Aliases - > When composing a representation graph from serialized events, an alias node refers to the most recent node in the serialization having the specified anchor. Therefore, anchors need not be unique within a serialization. -* Added support for [tag mappings on the serializer](https://github.com/aaubry/YamlDotNet/pull/229). - Use `SerializerBuilder.WithTagMapping()` to register a new tag mapping on the serializer. -* Allow to [unregister components](https://github.com/aaubry/YamlDotNet/commit/43c18ecf482dd069784a2031d8d56c1fa3a81734) from the SerializerBuilder and DeserializerBuilder. - Use the `Without...` methods on `SerializerBuilder` and `DeserializerBuilder` for that. -* New [`DateTimeConverter`](https://github.com/aaubry/YamlDotNet/pull/234) - * It accepts [`DateTimeKind.Utc`](https://msdn.microsoft.com/en-us/library/shx7s921(v=vs.110).aspx) and [Standard Date and Time Format Strings](https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx) of "G" as its default parameters, if they are omitted. - * For deserialization, it accepts as many number of formats as we want. If a value doesn't match against provided formats, it will return [`FormatException`](https://msdn.microsoft.com/en-us/library/system.formatexception(v=vs.110).aspx). Please refer to my whole test cases. - * For serialization, it only considers the first format in the format list. -* Improve the (de)serializer builders so that it is possible to [wrap existing component registrations](https://github.com/aaubry/YamlDotNet/commit/204ff4979dca7e2cfcbe86cd1387bf6b6f2398c3). -* Added the `ApplyNamingConventions` property to `YamlMemberAttribute`. - When this property is true, naming conventions are not applied to the associated member. This solves [issue 228](https://github.com/aaubry/YamlDotNet/issues/228). - -## Bug fixes - -* Fixed [issue 189](https://github.com/aaubry/YamlDotNet/pull/205): extra '\0' after indentation indicators. -* Fixed [some issues](https://github.com/aaubry/YamlDotNet/commit/a662fe53e9fd351eee7eef195e617023fd4e1cd3) related to parsing and emitting comments. -* Fixed [deserialization of ulongs](https://github.com/aaubry/YamlDotNet/commit/62bcaacf5873f9fd94385a20200028595a1381a7) greater than long.MaxValue. -* Fixed [issue 218](https://github.com/aaubry/YamlDotNet/issues/218): Objects with custom type converters are traversed. -* [Avoid crashing with a StackOverflowException](https://github.com/aaubry/YamlDotNet/pull/223) when iterating over the AllNodes property when it's infinitely recursive. - -## Other - -* The samples have been added to the project as a new unit test project, to ensure that they stay up-to-date with the code. - In the future, a documentation page will be generated from the samples, that will show the sample, its documentation and respective output. - diff --git a/releases/4.2.0.md b/releases/4.2.0.md deleted file mode 100644 index f751f6e1b..000000000 --- a/releases/4.2.0.md +++ /dev/null @@ -1,16 +0,0 @@ -# Release 4.2.0 - -## New features - -* **Support for .NET Core (`netstandard1.3`).** - The project files have been converted to the new format, which means that older versions of Visual Studio may be unable to load them. - -## Development-related changes - -* YamlDotNet now uses [Cake](http://cakebuild.net/) to define the build script. Previously, custom powershell scripts were used. - -* [Docker](https://www.docker.com/) images are now available with everything that is required to build YamlDotNet, both [locally](https://hub.docker.com/r/aaubry/yamldotnet.local/), and on [Travis](https://hub.docker.com/r/aaubry/yamldotnet/). This is mostly useful for people wanting to develop on Linux, as it can be tricky to install the correct versions of the dependencies. - -* **Code samples are now part of the solution** - They are specified as tests, and the [samples](https://github.com/aaubry/YamlDotNet/wiki/Samples) section of the wiki is generated from their source code and their output. - diff --git a/releases/4.2.1.md b/releases/4.2.1.md deleted file mode 100644 index 0b937a65e..000000000 --- a/releases/4.2.1.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release 4.2.1 - -Bug fixes: - -* **Fix parser behavior when skipComments == false** - In most cases, the parser failed to parse after encountering a comment. - diff --git a/releases/4.2.2.md b/releases/4.2.2.md deleted file mode 100644 index 671713ee2..000000000 --- a/releases/4.2.2.md +++ /dev/null @@ -1,6 +0,0 @@ -# Release 4.2.2 - -Bug fixes: - -* Actually cache in CachedTypeInspector. - diff --git a/releases/4.2.3.md b/releases/4.2.3.md deleted file mode 100644 index 30af343d2..000000000 --- a/releases/4.2.3.md +++ /dev/null @@ -1,8 +0,0 @@ -# Release 4.2.3 - -Bug fixes: - -* Fix nested reference merging. -* Don't force coercion of dictionary keys to string. -* Fix public static method determining in PORTABLE mode. - diff --git a/releases/4.2.4.md b/releases/4.2.4.md deleted file mode 100644 index c6c467c56..000000000 --- a/releases/4.2.4.md +++ /dev/null @@ -1,13 +0,0 @@ -# Release 4.2.4 - -* Refactored the project and solution so that they load and build cleanly in VS2017. -* Reviewed the target platforms. - * **The currently supported platforms are now:** - * .NET Framework 4.5 - * .NET Framework 3.5 - * .NET Framework 2.0 (**experimental**) - * .NET Standard 1.3 - * Unity Subset v3.5 - * **The following platforms are no longer supported:** - * Profile259 (please upgrade to netstandard) - diff --git a/releases/4.3.0.md b/releases/4.3.0.md deleted file mode 100644 index a301e36d3..000000000 --- a/releases/4.3.0.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 4.3.0 - -* Add support for (de)serialization of System.Type - diff --git a/releases/4.3.1.md b/releases/4.3.1.md deleted file mode 100644 index 4bd7a031a..000000000 --- a/releases/4.3.1.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 4.3.1 - -* Avoid definition of SerializationException (and some other types) on NET Standard - diff --git a/releases/4.3.2.md b/releases/4.3.2.md deleted file mode 100644 index 182d2c720..000000000 --- a/releases/4.3.2.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release 4.3.2 - -* Fix issue #308: Comment on line start parsed as `inline` -* Fix bug where TypeConverter was being ignored on all platforms except .NET 3.5 -* Remove serialization support from exceptions. - * This is actually a breaking change, but I don't think that anyone relies on this. - diff --git a/releases/5.0.0.md b/releases/5.0.0.md deleted file mode 100644 index 8dcf07e88..000000000 --- a/releases/5.0.0.md +++ /dev/null @@ -1,37 +0,0 @@ -# Release 5.0.0 - -/!\ This release fixes a [security issue - CVE-2018-1000210](https://nvd.nist.gov/vuln/detail/CVE-2018-1000210). It is strongly recommended to upgrade, -mainly if you are parsing documents from sources that you do not trust. - -**Many thanks to [Kurt Boberg](mailto:kurt.boberg@docusign.com), from the DocuSign Application Security Team, who identified this issue and provided feedback on mitigation strategies.** - -* **Remove the legacy backwards-compatible syntax that enabled to create - `Serializer` and `Deserializer` directly then changing their configuration.** - In most cases, the calls to the constructors should be replaced by - instantiations of `SerializerBuilder` and `DeserializerBuilder`. - These can be configured at will, then used to create instances of - (De)serializer. - It is still possible to use the default constructors, if no configuration is needed. - -* **Drop support for specifying arbitrary type names in tags.** - Support for automatically resolving a fully qualified type name - from a tag has been discontinued. That feature was poorly designed - and not standard. - During deserialization, each tag mapping must be explicitly registered. - During serialization, when using the `EnsureRoundtrip` method, it is necessary to - register tag mappings for each type that will require a tag, that is, any type that - is used as the value of a property with a different declared type. - -* Fix bug where deserialized values were not being converted to the destination type. - ```c# - var sut = new DeserializerBuilder() - .WithTagMapping("!dbl", typeof(DoublyConverted)) - .Build(); - - // The scalar "hello" will first be converted to DoublyConverted - // then that value will be converted to int. - var result = sut.Deserialize("!dbl hello"); - - Assert.Equal(5, result); - ``` - diff --git a/releases/5.1.0.md b/releases/5.1.0.md deleted file mode 100644 index 856e6e636..000000000 --- a/releases/5.1.0.md +++ /dev/null @@ -1,8 +0,0 @@ -# Release 5.1.0 - -Improvements: -* Add interfaces for serializer and deserializer (fixes #350). - -Fixes: -* Fixed issue #348 that caused the assembly to have version 0.0.0.0. - diff --git a/releases/5.2.0.md b/releases/5.2.0.md deleted file mode 100644 index 10e6f1ab3..000000000 --- a/releases/5.2.0.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release 5.2.0 - -Improvements: -* Allow to specify the maximum recursion limit (fixes #352) with the [WithMaximumRecursion](https://github.com/aaubry/YamlDotNet/pull/353/files#diff-86074b6acff29ccad667aca741f62ac5R83) method. - diff --git a/releases/5.2.1.md b/releases/5.2.1.md deleted file mode 100644 index cc242cd9e..000000000 --- a/releases/5.2.1.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release 5.2.1 - -Bug fixes: -* Fix roundtripping of tags on sequences (#347) - diff --git a/releases/5.3.0.md b/releases/5.3.0.md deleted file mode 100644 index 8f4ad6a6f..000000000 --- a/releases/5.3.0.md +++ /dev/null @@ -1,9 +0,0 @@ -# Release 5.3.0 - -New features: -* Add support for supplying custom IObjectGraphTraversalStrategy implementations. -* Add abstract WithTagMapping() method to the base serializer / deserializer builder. - -Bug fixes: -* Use BenchmarkDotNet and Compile YamlDotNet with Optimize option in Release-* configurations - diff --git a/releases/5.3.1.md b/releases/5.3.1.md deleted file mode 100644 index f660c8d95..000000000 --- a/releases/5.3.1.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release 5.3.1 - -New features: -* Produce a detailed error message when too much recursion is detected during serialization. - diff --git a/releases/5.4.0.md b/releases/5.4.0.md deleted file mode 100644 index 280b97504..000000000 --- a/releases/5.4.0.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release 5.4.0 - -New features: -* **Enable serialization of public fields.** - YamlDotNet will now also serialize public fields. This feature is enabled by default, - but it can be disabled by calling `IgnoreFields()` on the `SerializerBuilder` or `DeserializerBuilder`. - diff --git a/releases/6.0.0.md b/releases/6.0.0.md deleted file mode 100644 index 7d314a869..000000000 --- a/releases/6.0.0.md +++ /dev/null @@ -1,11 +0,0 @@ -# Release 6.0.0 - -This release merges the YamlDotNet.Signed and YamlDotNet packages. -This change has the following consequences: - - - The **assemblies in the YamlDotNet package will now have strong names**. - This is a breaking change. If you depend on a library that depends on a - previous version of YamlDotNet, you will first need to update that library. - - - The **YamlDotNet.Signed package will cease to be published**. - The code should be updated to depend on YamlDotNet. diff --git a/releases/6.1.1.md b/releases/6.1.1.md deleted file mode 100644 index b5823fc65..000000000 --- a/releases/6.1.1.md +++ /dev/null @@ -1,23 +0,0 @@ -# Release 6.1.1 - -## New features - -Tests from yaml-test-suite have been added to the project and an effort has been made to improve the conformance, thanks to [@am11](https://github.com/am11): - -- [#395](https://github.com/aaubry/YamlDotNet/pull/395) Add spec test executor for yaml-test-suite -- [#400](https://github.com/aaubry/YamlDotNet/pull/400) Improve YAML spec conformance by three tests -- [#401](https://github.com/aaubry/YamlDotNet/pull/401) Allow scalar to have value without space (x:y) -- [#403](https://github.com/aaubry/YamlDotNet/pull/403) Relax anchor names allowed characters set -- [#404](https://github.com/aaubry/YamlDotNet/pull/404) Constrain DocumentEnd parsing to allowed tokens -- [#406](https://github.com/aaubry/YamlDotNet/pull/406) Improve omitted keys handling - -### Other changes: - -- Allow to save a `YamlStream` to an `IEmitter` -- Some infrastructural changes have been made to ensure that the project would build on Linux without issues. - -## Bug fixes - -- [#396](https://github.com/aaubry/YamlDotNet/pull/396) Fix missing string quotes around json serialized enums (fixes [#146](https://github.com/aaubry/YamlDotNet/issues/408)) -- Increase the max simple key length to 1024 and allow to configure it -- Never emit key indicators in JSON diff --git a/releases/6.1.2.md b/releases/6.1.2.md deleted file mode 100644 index a1e275527..000000000 --- a/releases/6.1.2.md +++ /dev/null @@ -1,30 +0,0 @@ -# Release 6.1.2 - -Improves conformance with the official test suite: - -* [W4TN](https://github.com/yaml/yaml-test-suite/tree/data/W4TN) (Spec Example 9.5. Directives Documents) -* [2LFX](https://github.com/yaml/yaml-test-suite/tree/data/2LFX) (Spec Example 6.13. Reserved Directives [1.3]) -* [6LVF](https://github.com/yaml/yaml-test-suite/tree/data/6LVF) (Spec Example 6.13. Reserved Directives) -* [S3PD](https://github.com/yaml/yaml-test-suite/tree/data/S3PD) (Spec Example 8.18. Implicit Block Mapping Entries) -* [NHX8](https://github.com/yaml/yaml-test-suite/tree/data/NHX8) (Empty Lines at End of Document) -* [2JQS](https://github.com/yaml/yaml-test-suite/tree/data/2JQS) (Block Mapping with Missing Keys) -* [M7A3](https://github.com/yaml/yaml-test-suite/tree/data/M7A3) (Spec Example 9.3. Bare Documents) -* [WZ62](https://github.com/yaml/yaml-test-suite/tree/data/WZ62) (Spec Example 7.2. Empty Content) -* [52DL](https://github.com/yaml/yaml-test-suite/tree/data/52DL) (Explicit Non-Specific Tag [1.3]) -* [S4JQ](https://github.com/yaml/yaml-test-suite/tree/data/S4JQ) (Spec Example 6.28. Non-Specific Tags) -* [8MK2](https://github.com/yaml/yaml-test-suite/tree/data/8MK2) (Explicit Non-Specific Tag) -* [R4YG](https://github.com/yaml/yaml-test-suite/tree/data/R4YG) (Spec Example 8.2. Block Indentation Indicator) -* [6BCT](https://github.com/yaml/yaml-test-suite/tree/data/6BCT) (Spec Example 6.3. Separation Spaces) -* [A2M4](https://github.com/yaml/yaml-test-suite/tree/data/A2M4) (Spec Example 6.2. Indentation Indicators) -* [Q5MG](https://github.com/yaml/yaml-test-suite/tree/data/Q5MG) (Tab at beginning of line followed by a flow mapping) -* [S7BG](https://github.com/yaml/yaml-test-suite/tree/data/S7BG) (Colon followed by comma) -* [DK3J](https://github.com/yaml/yaml-test-suite/tree/data/DK3J) (Zero indented block scalar with line that looks like a comment) -* [FP8R](https://github.com/yaml/yaml-test-suite/tree/data/FP8R) (Zero indented block scalar) -* [4MUZ](https://github.com/yaml/yaml-test-suite/tree/data/4MUZ) (Flow mapping colon on line after key) -* [NJ66](https://github.com/yaml/yaml-test-suite/tree/data/NJ66) (Multiline plain flow mapping key) -* [UT92](https://github.com/yaml/yaml-test-suite/tree/data/UT92) (Spec Example 9.4. Explicit Documents) -* [9SA2](https://github.com/yaml/yaml-test-suite/tree/data/9SA2) (Multiline double quoted flow mapping key) -* [K3WX](https://github.com/yaml/yaml-test-suite/tree/data/K3WX) (Colon and adjacent value after comment on next line) -* [5MUD](https://github.com/yaml/yaml-test-suite/tree/data/5MUD) (Colon and adjacent value on next line) - -Also adds the license file to nupkg to fix NU5125 warning. diff --git a/releases/7.0.0.md b/releases/7.0.0.md deleted file mode 100644 index cf0c3213d..000000000 --- a/releases/7.0.0.md +++ /dev/null @@ -1,48 +0,0 @@ -# Release 7.0.0 - -Added support for **nullable references** and **netstandard 2.1**. - -Enabling nullable references exposed many potential bugs where the code assumed -that a reference would not be null, but where it was possible for it to be null. -In most cases this did not cause an error because of the way the code was being used. - -Because fixing these problems required some breaking changes, a few improvements were made to the code base to take advantage of modern C# constructs. - -Overall, the following **breaking changes** were made: - -- **Removed the default constructor from most exceptions**, because that would cause some uninitialized properties. - -- Made the **`ParsingEvent` concretizations sealed**. There is no point in inheriting from these because the library assumes that they form a closed set. - -- **Made many classes sealed**, since they are not intended to be extended. - -- **`YamlDocument` now throws an exception** if is has no root node after loading. This should only happen when loading from an `IParser` that returns invalid data or is in an invalid state. - -The following APIs were made **obsolete** (but still work as before): - -- Refactored the **extension methods to `IParser`** to have better names with a more sensible semantic. The previous extension methods, `Expect`, `Allow`, `Peek` and `Accept` are still available but have been deprecated. The new extension methods are: - - - `T Consume() where T : ParsingEvent` - Ensures that the current event is of the specified type, returns it and moves to the next event. Throws an exception if the next event is not of the expected type. - - - `bool TryConsume(out T @event) where T : ParsingEvent` - If the event is of the specified type, returns it and moves to the next event, otherwise returns null. - - - `T Require() where T : ParsingEvent` - Enforces that the current event is of the specified type. - - - `bool Accept(out T @event) where T : ParsingEvent` - Checks whether the current event is of the specified type. - -- Made the **constructor of all naming conventions obsolete**. Instead each has a static property named `Instance`. There was no point in creating multiple instances of those classes. - Instead of: - ```c# - new SerializerBuilder() - .WithNamingConvention(new CamelCaseNamingConvention()); - ``` - Use: - ```c# - new SerializerBuilder() - .WithNamingConvention(CamelCaseNamingConvention.Instance); - ``` - diff --git a/releases/8.0.0.md b/releases/8.0.0.md deleted file mode 100644 index 2c25c4cf2..000000000 --- a/releases/8.0.0.md +++ /dev/null @@ -1,23 +0,0 @@ -# Release 8.0.0 - -## New features and improvements - -- Change the default value handling behavior. Fixes #427 - This is a **breaking change** to the default behaviour of the serializer, which will now **always emit null and default values**. - It is possible to configure this behaviour by using the `ConfigureDefaultValuesHandling` method on `SerializerBuilder`. - - [More details are available in the documentation.](https://github.com/aaubry/YamlDotNet/wiki/Serialization.Serializer#configuredefaultvalueshandlingdefaultvalueshandling) - -- Add default implementations for the following non-generic collections to `DefaultObjectFactory`: - - IEnumerable - - ICollection - - IList - - IDictionary - -- Remove obsolete and unused `SerializationOptions` enum. Fixes #438 -- Throw descriptive exceptions when using the "linq" methods of `YamlNode`. Relates to #437 - -## Bug fixes - -- Never emit document end indicator on stream end. Fixes #436 -- Fix exception when deserializing an interface. Fixes #439 diff --git a/releases/8.1.0.md b/releases/8.1.0.md deleted file mode 100644 index 46563c07d..000000000 --- a/releases/8.1.0.md +++ /dev/null @@ -1,12 +0,0 @@ -# Release 8.1.0 - -## New features and improvements - -- Made CachedTypeInspector thread safe #386 - Previously, using an instance of `Serializer` or `Deserializer` was not thread-safe, - although the intention was for them to be thread safe. The only mutable state is - inside CachedTypeInspector and was not properly protected against concurrent mutation. - -## Other fixes - -- Fix type conflicts when targeting frameworks without nullability attributes #460 diff --git a/releases/8.1.1.md b/releases/8.1.1.md deleted file mode 100644 index e82b8e505..000000000 --- a/releases/8.1.1.md +++ /dev/null @@ -1,13 +0,0 @@ -# Release 8.1.1 - -## Bug fixes - -- Improve compliance with the official YAML test suite: #467, #469 and #475. - -- Make YamlMemberAttribute.DefaultValuesHandling actually usable. Fixes #466. - -- Actually inherit YamlIgnore attributes: #481. - -## New features - -- Add LowerCaseNamingConvention: #477. diff --git a/releases/8.1.2.md b/releases/8.1.2.md deleted file mode 100644 index c249ab7b7..000000000 --- a/releases/8.1.2.md +++ /dev/null @@ -1,6 +0,0 @@ -# Release 8.1.2 - -## Bug fixes - -- Merge #483 - Allow values after DocumentStart token -- Merge #497 - Fix indentation check for first content line - fixes #492 diff --git a/releases/9.1.0.md b/releases/9.1.0.md deleted file mode 100644 index 5af61b846..000000000 --- a/releases/9.1.0.md +++ /dev/null @@ -1,16 +0,0 @@ -# Release 9.1.0 - -## Improvements - -- Small performance improvements. Addresses [#519] -- [#490] Add anchor/alias support in JsonEventEmitter -- [#540] Allow block style in multiline scalars with trailing spaces -- [#482] Add support for private properties in the serializer. - -## Bugfixes - -- Fix KeyNotFoundException in WithoutTypeInspector (fixes [#507]) -- [#539] Fix deserialization for Nullable types. -- [#491] Disallow usage of alias before anchor declaration -- [#542] **Fix the order of YamlMappingNode items** - YamlMappingNode will now return the items in the order they appear inside the document. diff --git a/releases/9.1.1.md b/releases/9.1.1.md deleted file mode 100644 index 3c99063a9..000000000 --- a/releases/9.1.1.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release 9.1.1 - -- Fix off by one error when resizing InsertionQueue - -This fixes a critical bug that was causing failures while parsing Yaml documents. If you are using release 9.1.0, please use this version instead. diff --git a/releases/9.1.2.md b/releases/9.1.2.md deleted file mode 100644 index 5186ab724..000000000 --- a/releases/9.1.2.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release 9.1.2 - -- Fix writePtr decrementation in InsertionQueue [#558] - -This fixes another critical bug that was causing failures while parsing Yaml documents. If you are using release 9.1.1, please use this version instead. diff --git a/releases/9.1.3.md b/releases/9.1.3.md deleted file mode 100644 index 30a1f3fa0..000000000 --- a/releases/9.1.3.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release 9.1.3 - -- Fix an error when a stream returns less than the requested amount of bytes - Fixes #560 diff --git a/releases/9.1.4.md b/releases/9.1.4.md deleted file mode 100644 index e26a566ec..000000000 --- a/releases/9.1.4.md +++ /dev/null @@ -1,3 +0,0 @@ -# Release 9.1.4 - -- Fix LookAheadBuffer trying to read from the stream after reaching its end diff --git a/tools/build/BuildDefinition.cs b/tools/build/BuildDefinition.cs index aa2971337..971cfffbc 100644 --- a/tools/build/BuildDefinition.cs +++ b/tools/build/BuildDefinition.cs @@ -5,10 +5,14 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; using System.Xml.Linq; using static build.Program; using static SimpleExec.Command; @@ -175,62 +179,72 @@ public static ScaffoldedRelease ScaffoldReleaseNotes(GitVersion version, Previou throw new InvalidOperationException("Cannot release a pre-release version."); } - var releaseNotesPath = Path.Combine(BasePath, "releases", $"{version.NuGetVersion}.md"); + var previousVersion = releases.Versions.First(); - string releaseNotes; - bool reviewed; - WriteVerbose($"ReleaseNotesPath: {releaseNotesPath}"); - if (File.Exists(releaseNotesPath)) - { - WriteInformation("Keeping existing release notes."); - - releaseNotes = File.ReadAllText(releaseNotesPath); - reviewed = true; - } - else - { - var previousVersion = releases.Versions.First(); - - // Get the git log to scaffold the release notes - string? currentHash = null; - var commits = ReadLines("git", $"rev-list v{previousVersion}..HEAD --first-parent --reverse --pretty=tformat:%B") - .Select(l => + // Get the git log to scaffold the release notes + string? currentHash = null; + var commits = ReadLines("git", $"rev-list v{previousVersion}..HEAD --first-parent --reverse --pretty=tformat:%B") + .Select(l => + { + var match = Regex.Match(l, "^commit (?[a-f0-9]+)$"); + if (match.Success) { - var match = Regex.Match(l, "^commit (?[a-f0-9]+)$"); - if (match.Success) - { - currentHash = match.Groups["hash"].Value; - } - return new - { - message = l, - commit = currentHash - }; - }) - .GroupBy(l => l.commit, (k, list) => new + currentHash = match.Groups["hash"].Value; + } + return new { - commit = k, - message = list - .Skip(1) - .Select(l => Regex.Replace(l.message, @"\+semver:\s*\w+", "").Trim()) - .Where(l => !string.IsNullOrEmpty(l)) - .ToList() - }); + message = l, + commit = currentHash + }; + }) + .GroupBy(l => l.commit, (k, list) => new + { + commit = k, + message = list + .Skip(1) + .Select(l => Regex.Replace(l.message, @"\+semver:\s*\w+", "").Trim()) + .Where(l => !string.IsNullOrEmpty(l)) + .ToList() + }); - var log = commits - .Select(c => c.message.Select((l, i) => $"{(i == 0 ? '-' : ' ')} {l}")) - .Select(c => string.Join(" \n", c)); + var log = commits + .Select(c => c.message.Select((l, i) => $"{(i == 0 ? '-' : ' ')} {l}")) + .Select(c => string.Join(" \n", c)); - releaseNotes = $"# Release {version.NuGetVersion}\n\n{string.Join("\n\n", log)}"; + var releaseNotes = $"# Release {version.NuGetVersion}\n\n{string.Join("\n\n", log)}"; + + WriteVerbose(releaseNotes); - File.WriteAllText(releaseNotesPath, releaseNotes); + return new ScaffoldedRelease(releaseNotes); + } - WriteImportant($"Please review the release notes:\n{releaseNotesPath}"); - reviewed = false; - } - WriteVerbose(releaseNotes); + public static async Task CreateGithubRelease(GitVersion version, ScaffoldedRelease release) + { + var token = Environment.GetEnvironmentVariable("GITHUB_TOKEN") ?? throw new InvalidOperationException("Please set the GITHUB_TOKEN environment variable."); + var repository = Environment.GetEnvironmentVariable("GITHUB_REPOSITORY") ?? "aaubry/YamlDotNet.Sandbox"; + + using var apiClient = new HttpClient(new LoggerHttpHandler()) + { + BaseAddress = new Uri("https://api.github.com"), + }; - return new ScaffoldedRelease(releaseNotes, releaseNotesPath, reviewed); + apiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); + apiClient.DefaultRequestHeaders.Add("User-Agent", repository.Split('/')[0]); + apiClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", token); + + var releaseResponse = await apiClient.PostAsJsonAsync($"/repos/{repository}/releases", new + { + tag_name = $"v{version.NuGetVersion}", + target_commitish = version.Sha, + body = release.ReleaseNotes, + draft = true, + prerelease = version.IsPreRelease, + }); + + releaseResponse.EnsureSuccessStatusCode(); + + var releaseInfo = await releaseResponse.Content.ReadAsAsync(); + WriteImportant($"Release draft created:\n{releaseInfo.html_url}"); } public static PreviousReleases DiscoverPreviousReleases() @@ -254,45 +268,6 @@ public static PreviousReleases DiscoverPreviousReleases() return previousReleases; } - public static void Release(GitVersion version, ScaffoldedRelease scaffoldedRelease, PreviousReleases previousReleases) - { - if (!scaffoldedRelease.Reviewed) - { - WriteImportant("Please review the release notes before proceeding."); - return; - } - - var previousReleaseNotesLinks = previousReleases.Versions - .Select(v => new - { - Version = v, - RelativePath = $"releases/{v}.md", - AbsolutePath = Path.Combine(BasePath, "releases", $"{v}.md"), - }) - .Where(r => File.Exists(r.AbsolutePath)) - .Select(r => $"- [{r.Version}]({r.RelativePath})"); - - var releaseNotesFile = string.Join("\n", - "# Release notes", - "", - Regex.Replace(scaffoldedRelease.ReleaseNotes, @"^#", "##"), - "", - "# Previous releases", - "", - string.Join("\n", previousReleaseNotesLinks) - ); - - var releaseNotesPath = Path.Combine(BasePath, "RELEASE_NOTES.md"); - File.WriteAllText(releaseNotesPath, releaseNotesFile); - - Run("git", $"add \"{releaseNotesPath}\""); - Run("git", $"add \"{scaffoldedRelease.ReleaseNotesPath}\""); - Run("git", $"commit -m \"Prepare release {version.NuGetVersion}\""); - Run("git", $"tag v{version.NuGetVersion}"); - - WriteImportant($"Your release is ready. Remember to push it using the following commands:\n\n git push && git push origin v{version.NuGetVersion}"); - } - public static void Document(Options options) { var samplesProjectDir = Path.Combine(BasePath, "YamlDotNet.Samples"); @@ -413,6 +388,7 @@ public class GitVersion : IEquatable public int Patch { get; set; } public string? PreReleaseLabel { get; set; } public string? CommitsSinceVersionSourcePadded { get; set; } + public string? Sha { get; set; } public string NuGetVersion { @@ -447,16 +423,12 @@ public struct SuccessfulUnitTests { } public class ScaffoldedRelease { - public ScaffoldedRelease(string releaseNotes, string releaseNotesPath, bool reviewed) + public ScaffoldedRelease(string releaseNotes) { ReleaseNotes = releaseNotes; - ReleaseNotesPath = releaseNotesPath; - Reviewed = reviewed; } public string ReleaseNotes { get; set; } - public string ReleaseNotesPath { get; set; } - public bool Reviewed { get; } } public class PreviousReleases @@ -480,4 +452,20 @@ public NuGetPackage(string path) public string Path { get; } } + + internal class LoggerHttpHandler : HttpClientHandler + { + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + var requestText = await request.Content.ReadAsStringAsync(); + WriteVerbose($"> {request.Method} {request.RequestUri}\n{requestText}\n".Replace("\n", "\n> ")); + + var response = await base.SendAsync(request, cancellationToken); + + var responseText = await response.Content.ReadAsStringAsync(); + WriteVerbose($"< {response.StatusCode}\n{responseText}\n".Replace("\n", "\n< ")); + + return response; + } + } } diff --git a/tools/build/GitHubApiModels.cs b/tools/build/GitHubApiModels.cs new file mode 100644 index 000000000..a5545306d --- /dev/null +++ b/tools/build/GitHubApiModels.cs @@ -0,0 +1,10 @@ +namespace build +{ + internal static class GitHubApiModels + { + public class Release + { + public string? html_url { get; set; } + } + } +} diff --git a/tools/build/Program.cs b/tools/build/Program.cs index 5046a704a..4e5ef1644 100644 --- a/tools/build/Program.cs +++ b/tools/build/Program.cs @@ -9,6 +9,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; +using System.Threading.Tasks; using static Bullseye.Targets; using OperatingSystem = Bullseye.Internal.OperatingSystem; @@ -57,20 +58,43 @@ private static void RegisterTargets() dependencies.Select(d => Expression.Call(getState.MakeGenericMethod(d))) ); - if (targetMethod.ReturnType != typeof(void)) + var returnType = targetMethod.ReturnType; + var isAsync = typeof(Task).IsAssignableFrom(returnType); + if (isAsync) + { + returnType = returnType.IsGenericType ? returnType.GetGenericArguments()[0] : typeof(void); + + if (returnType != typeof(void)) + { + actionExpression = Expression.Property( + actionExpression, + nameof(Task.Result) + ); ; + } + else + { + actionExpression = Expression.Call( + actionExpression, + nameof(Task.Wait), + null + ); + } + } + + if (returnType != typeof(void)) { actionExpression = Expression.Call( - setState.MakeGenericMethod(targetMethod.ReturnType), + setState.MakeGenericMethod(returnType), actionExpression ); - if (providerTargets.ContainsKey(targetMethod.ReturnType)) + if (providerTargets.ContainsKey(returnType)) { - var duplicates = targetMethods.Where(m => m.ReturnType == targetMethod.ReturnType).Select(m => m.Name); - throw new InvalidOperationException($"Multiple targets provide the same type '{targetMethod.ReturnType.FullName}': {string.Join(", ", duplicates)}"); + var duplicates = targetMethods.Where(m => m.ReturnType == returnType).Select(m => m.Name); + throw new InvalidOperationException($"Multiple targets provide the same type '{returnType.FullName}': {string.Join(", ", duplicates)}"); } - providerTargets.Add(targetMethod.ReturnType, targetMethod.Name); + providerTargets.Add(returnType, targetMethod.Name); } var action = Expression.Lambda(actionExpression); @@ -205,18 +229,20 @@ public static void WriteImportant(string text) private static void WriteBoxed(string text, string color) { - const int boxWidth = 50; - var boxElements = palette.Dash == '─' ? "┌┐└┘│─" : "++++|-"; + var boxWidth = 50; + var wrappedText = WrapText(text, boxWidth - 4).ToList(); + boxWidth = Math.Max(boxWidth, wrappedText.Max(l => l.Length) + 4); + Console.WriteLine(); Write($" {boxElements[0]}{new string(boxElements[5], boxWidth - 2)}{boxElements[1]}", color); foreach (var line in WrapText(text, boxWidth - 4)) { - Write($" {boxElements[4]} {line,-(boxWidth - 4)} {boxElements[4]}", color); + Write($" {boxElements[4]} {line.PadRight(boxWidth - 4)} {boxElements[4]}", color); } Write($" {boxElements[2]}{new string(boxElements[5], boxWidth - 2)}{boxElements[3]}", color); diff --git a/tools/build/build.csproj b/tools/build/build.csproj index e6a880193..d3f91b0a1 100644 --- a/tools/build/build.csproj +++ b/tools/build/build.csproj @@ -9,6 +9,7 @@ +