Skip to content

Commit 0678e7a

Browse files
committed
Follow up #2286 Release v24.0 | Artifacts and bug fixing
1 parent 56ae08e commit 0678e7a

15 files changed

+174
-69
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
![Ocelot Logo](https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/ocelot_logo.png)
1+
![Ocelot Logo](https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/ocelot_logo.png)
22

33
[![Release Status](https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml/badge.svg)](https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml)
44
[![Development Status](https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml/badge.svg)](https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml)
5-
[![ReadTheDocs Status](https://readthedocs.org/projects/ocelot/badge/?version=latest&style=flat-square)](https://app.readthedocs.org/projects/ocelot/builds/?version__slug=latest)
6-
[![Coveralls Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=main)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=main)
5+
[![ReadTheDocs](https://readthedocs.org/projects/ocelot/badge/?version=latest&style=flat-square)](https://app.readthedocs.org/projects/ocelot/builds/?version__slug=latest)
6+
[![Coveralls](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=main)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=main)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ThreeMammals/Ocelot/blob/main/LICENSE.md)
88
[![NuGet](https://img.shields.io/nuget/v/Ocelot?logo=nuget&label=NuGet&color=blue)](https://www.nuget.org/packages/Ocelot/ "Download Ocelot from NuGet.org")
99
[![Downloads](https://img.shields.io/nuget/dt/Ocelot?logo=nuget&label=Downloads)](https://www.nuget.org/packages/Ocelot/ "Total Ocelot downloads from NuGet.org")
1010

11+
[~docspassing]: https://img.shields.io/badge/Docs-passing-44CC11?style=flat-square
12+
[~docsfailing]: https://img.shields.io/badge/Docs-failing-red?style=flat-square
13+
1114
## About
1215
Ocelot is a .NET [API gateway](https://www.bing.com/search?q=API+gateway).
1316
This project is aimed at people using .NET running a microservices (service-oriented) architecture that needs a unified point of entry into their system.
@@ -64,30 +67,32 @@ All versions are available [on NuGet](https://www.nuget.org/packages/Ocelot#vers
6467

6568
## Documentation
6669
- [RST-sources](https://github.com/ThreeMammals/Ocelot/tree/develop/docs):
67-
This includes the source code of the documentation as **.rst**-files, which are up to date for current development.
70+
This includes the source code for the documentation (in reStructuredText format, .rst files), which is up to date for the current [development](https://github.com/ThreeMammals/Ocelot/tree/develop/).
71+
And the rendered HTML documentation is available [here](https://ocelot.readthedocs.io/en/develop/).
6872
- [Read the Docs](https://ocelot.readthedocs.io):
69-
This includes a lot of information and will be helpful if you want to understand the features Ocelot currently offers.
73+
This official website, in HTML format, contains a wealth of information and will be helpful if you want to understand the [features](#features) that Ocelot currently offers.
74+
The rendered HTML documentation, which is currently in [development](https://github.com/ThreeMammals/Ocelot/tree/develop/docs), is available [here](https://ocelot.readthedocs.io/en/develop/).
7075
- [Ask Ocelot Guru](https://gurubase.io/g/ocelot):
71-
It is an Ocelot-focused AI designed to answer your questions. [^5]
76+
It is an AI focused on Ocelot, designed to answer your questions. [^5]
7277

7378
## Coming up
7479
You can see what we are working on in the [backlog](https://github.com/ThreeMammals/Ocelot/issues).
7580

7681
## Contributing
7782
We love to receive contributions from the community, so please keep them coming.
78-
Pull requests, issues, and commentary welcome! <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="20" />
83+
Pull requests, issues, and commentary welcome! <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="25" />
7984

8085
Please complete the relevant [template](https://github.com/ThreeMammals/Ocelot/tree/main/.github) for [issues](https://github.com/ThreeMammals/Ocelot/blob/main/.github/ISSUE_TEMPLATE.md) and [pull requests](https://github.com/ThreeMammals/Ocelot/blob/main/.github/PULL_REQUEST_TEMPLATE.md).
8186
Sometimes it's worth getting in touch with us to [discuss](https://github.com/ThreeMammals/Ocelot/discussions) changes before doing any work in case this is something we are already doing or it might not make sense.
82-
We can also give advice on the easiest way to do things <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="20" />
87+
We can also give advice on the easiest way to do things <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="25" />
8388

8489
Finally, we mark all existing issues as [![label: help wanted][~helpwanted]](https://github.com/ThreeMammals/Ocelot/labels/help%20wanted)
8590
[![label: small effort][~smalleffort]](https://github.com/ThreeMammals/Ocelot/labels/small%20effort)
8691
[![label: medium effort][~mediumeffort]](https://github.com/ThreeMammals/Ocelot/labels/medium%20effort)
8792
[![label: large effort][~largeeffort]](https://github.com/ThreeMammals/Ocelot/labels/large%20effort). [^6]
8893
If you want to contribute for the first time, we suggest looking at a [![label: help wanted][~helpwanted]](https://github.com/ThreeMammals/Ocelot/labels/help%20wanted)
8994
[![label: small effort][~smalleffort]](https://github.com/ThreeMammals/Ocelot/labels/small%20effort)
90-
[![label: good first issue][~goodfirstissue]](https://github.com/ThreeMammals/Ocelot/labels/good%20first%20issue) <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="20" />
95+
[![label: good first issue][~goodfirstissue]](https://github.com/ThreeMammals/Ocelot/labels/good%20first%20issue) <img src="https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png" alt="octocat" height="25" />
9196

9297
[~helpwanted]: https://img.shields.io/badge/-help%20wanted-128A0C.svg
9398
[~smalleffort]: https://img.shields.io/badge/-small%20effort-fef2c0.svg

build.cake

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Task("Compile")
9292
.IsDependentOn("Version")
9393
.Does(() =>
9494
{
95+
PreprocessReadMe();
9596
Information("Branch: " + GetBranchName());
9697
Information("Build: " + compileConfig);
9798
Information("Solution: " + slnFile);
@@ -181,7 +182,7 @@ Task("CreateReleaseNotes")
181182
// Read main header from Git file, substitute version in header, and add content further...
182183
Information("{0} New release tag is " + releaseVersion);
183184
Information("{1} Last release tag is " + lastRelease);
184-
var body = System.IO.File.ReadAllText("./ReleaseNotes.md");
185+
var body = System.IO.File.ReadAllText("./ReleaseNotes.md", System.Text.Encoding.UTF8);
185186
var releaseHeader = string.Format(body, releaseVersion, lastRelease);
186187
releaseNotes = new List<string> { releaseHeader };
187188
if (IsTechnicalRelease)
@@ -466,7 +467,7 @@ private void WriteReleaseNotes()
466467
var content = System.IO.File.ReadAllText(releaseNotesFile, Encoding.UTF8);
467468
if (string.IsNullOrEmpty(content))
468469
{
469-
System.IO.File.WriteAllText(releaseNotesFile, "No commits since last release");
470+
System.IO.File.WriteAllText(releaseNotesFile, "No commits since last release", System.Text.Encoding.UTF8);
470471
}
471472
Information("Release notes are >>>{0}<<<", NL + content);
472473
}
@@ -654,7 +655,7 @@ Task("PublishGitHubRelease")
654655
if (!IsRunningInCICD())
655656
{
656657
Warning("We are not running on the CI/CD so we won't publish a GitHub release");
657-
return;
658+
//return;
658659
}
659660

660661
dynamic release = CreateGitHubRelease();
@@ -717,24 +718,60 @@ Task("PublishToNuget")
717718
Information("Skipping of publishing to NuGet because of technical release...");
718719
return;
719720
}
720-
721-
if (IsRunningInCICD())
722-
{
723-
var nugetFeedStableKey = EnvironmentVariable("OCELOT_NUGET_API_KEY_2025");
724-
var nugetFeedStableUploadUrl = "https://www.nuget.org/api/v2/package";
725-
var nugetFeedStableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package";
726-
PublishPackages(packagesDir, artifactsFile, nugetFeedStableKey, nugetFeedStableUploadUrl, nugetFeedStableSymbolsUploadUrl);
727-
}
728-
else
721+
if (!IsRunningInCICD())
729722
{
730723
Warning("We are not running on the CI/CD so we won't publish NuGet packages.");
724+
//return;
731725
}
726+
var nugetFeedStableKey = EnvironmentVariable("OCELOT_NUGET_API_KEY_2025");
727+
var nugetFeedStableUploadUrl = "https://www.nuget.org/api/v2/package";
728+
var nugetFeedStableSymbolsUploadUrl = "https://www.nuget.org/api/v2/package";
729+
PublishPackages(packagesDir, artifactsFile, nugetFeedStableKey, nugetFeedStableUploadUrl, nugetFeedStableSymbolsUploadUrl);
732730
});
733731

734732
Task("Void").Does(() => {});
735733

736734
RunTarget(target);
737735

736+
private void PreprocessReadMe()
737+
{
738+
const string READMEmd = "./README.md";
739+
const string RTD_NuGet_Valid_Domain = "[ReadTheDocs][~docspassing]";
740+
const string RTD_Version_Latest = "[ReadTheDocs](https://readthedocs.org/projects/ocelot/badge/?version=latest&style=flat-square)";
741+
const string RTD_Version_Develop = "[ReadTheDocs](https://readthedocs.org/projects/ocelot/badge/?version=develop&style=flat-square)";
742+
Information($"Processing {READMEmd} ...");
743+
var body = System.IO.File.ReadAllText(READMEmd, System.Text.Encoding.UTF8);
744+
var RTD_IsReplaced = false;
745+
if (body.Contains(RTD_Version_Latest))
746+
{
747+
Information($" {READMEmd}: Detected ReadTheDocs LATEST version marker -> {RTD_Version_Latest}");
748+
body = body.Replace(RTD_Version_Latest, RTD_NuGet_Valid_Domain);
749+
RTD_IsReplaced = true;
750+
}
751+
if (body.Contains(RTD_Version_Develop))
752+
{
753+
Information($" {READMEmd}: Detected ReadTheDocs DEVELOP version marker -> {RTD_Version_Develop}");
754+
body = body.Replace(RTD_Version_Develop, RTD_NuGet_Valid_Domain);
755+
RTD_IsReplaced = true;
756+
}
757+
if (RTD_IsReplaced)
758+
{
759+
Information($" {READMEmd}: ReadTheDocs badge has been replaced with -> {RTD_NuGet_Valid_Domain}");
760+
}
761+
762+
const string IMG_Octocat_HTML = "<img src=\"https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat.png\" alt=\"octocat\" height=\"25\" />";
763+
const string IMG_NuGet_Valid_MD = "![octocat](https://raw.githubusercontent.com/ThreeMammals/Ocelot/refs/heads/assets/images/octocat-25px.png)";
764+
if (body.Contains(IMG_Octocat_HTML))
765+
{
766+
Information($" {READMEmd}: Detected Octocat HTML IMG-tag -> " + IMG_Octocat_HTML);
767+
body = body.Replace(IMG_Octocat_HTML, IMG_NuGet_Valid_MD);
768+
Information($" {READMEmd}: Octocat HTML IMG-tag has been replaced with -> " + IMG_NuGet_Valid_MD);
769+
}
770+
Information($" {READMEmd}: Writing the body of the {READMEmd}...");
771+
System.IO.File.WriteAllText(READMEmd, body, System.Text.Encoding.UTF8);
772+
Information($"DONE Processing {READMEmd}{NL}");
773+
}
774+
738775
private void GenerateReport(Cake.Core.IO.FilePath coverageSummaryFile)
739776
{
740777
var dir = System.IO.Directory.GetCurrentDirectory();
@@ -772,17 +809,17 @@ private void PersistVersion(string committedVersion, string newVersion)
772809
var file = projectFile.ToString();
773810
Information(string.Format("Updating {0}...", file));
774811

775-
var updatedProjectFile = System.IO.File.ReadAllText(file)
812+
var updatedProjectFile = System.IO.File.ReadAllText(file, System.Text.Encoding.UTF8)
776813
.Replace(committedVersion, newVersion);
777814

778-
System.IO.File.WriteAllText(file, updatedProjectFile);
815+
System.IO.File.WriteAllText(file, updatedProjectFile, System.Text.Encoding.UTF8);
779816
}
780817
}
781818

782819
/// Publishes code and symbols packages to nuget feed, based on contents of artifacts file
783820
private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFilePath artifactsFile, string feedApiKey, string codeFeedUrl, string symbolFeedUrl)
784821
{
785-
Information("PublishPackages: Publishing to NuGet...");
822+
Information($"{nameof(PublishPackages)}: Publishing to NuGet...");
786823
var artifacts = System.IO.File
787824
.ReadAllLines(artifactsFile)
788825
.Distinct();
@@ -794,17 +831,30 @@ private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFi
794831
// "Ocelot.Tracing.Butterfly",
795832
// "Ocelot.Tracing.OpenTracing",
796833
};
834+
var errors = new List<string>();
797835
foreach (var artifact in artifacts)
798836
{
799837
if (skippable.Exists(x => artifact.StartsWith(x)))
800838
continue;
801839

802840
var codePackage = packagesDir + File(artifact);
803-
Information("PublishPackages: Pushing package " + codePackage + "...");
804-
DotNetNuGetPush(
805-
codePackage,
806-
new DotNetNuGetPushSettings { ApiKey = feedApiKey, Source = codeFeedUrl }
807-
);
841+
Information($"{nameof(PublishPackages)}: Pushing package " + codePackage + "...");
842+
try
843+
{
844+
DotNetNuGetPush(codePackage,
845+
new DotNetNuGetPushSettings { ApiKey = feedApiKey, Source = codeFeedUrl });
846+
}
847+
catch (Exception e)
848+
{
849+
errors.Add(e.Message);
850+
}
851+
}
852+
if (errors.Count > 0)
853+
{
854+
Information($"{nameof(PublishPackages)}: Errors >>>");
855+
var err = string.Join(NL, errors);
856+
Warning(err);
857+
throw new Exception(err);
808858
}
809859
}
810860

@@ -819,7 +869,7 @@ private void SetupGitHubClient(System.Net.Http.HttpClient client)
819869

820870
private dynamic CreateGitHubRelease()
821871
{
822-
var json = $"{{ \"tag_name\": \"{versioning.SemVer}\", \"target_commitish\": \"main\", \"name\": \"{versioning.SemVer}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": true, \"prerelease\": true, \"generate_release_notes\": false }}";
872+
var json = $"{{ \"tag_name\": \"{versioning.SemVer}\", \"target_commitish\": \"{versioning.BranchName}\", \"name\": \"{versioning.SemVer}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": true, \"prerelease\": true, \"generate_release_notes\": false }}";
823873
var content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");
824874

825875
using (var client = new System.Net.Http.HttpClient())
@@ -841,7 +891,8 @@ private dynamic CreateGitHubRelease()
841891

842892
private string ReleaseNotesAsJson()
843893
{
844-
return System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(System.IO.File.ReadAllText(releaseNotesFile));
894+
var body = System.IO.File.ReadAllText(releaseNotesFile, System.Text.Encoding.UTF8);
895+
return System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(body);
845896
}
846897

847898
private void UploadFileToGitHubRelease(dynamic release, FilePath file)
@@ -873,7 +924,7 @@ private void CompleteGitHubRelease(dynamic release)
873924
{
874925
int releaseId = release.id;
875926
string url = release.url.ToString();
876-
var json = $"{{ \"tag_name\": \"{versioning.SemVer}\", \"target_commitish\": \"main\", \"name\": \"{versioning.SemVer}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": false, \"prerelease\": false }}";
927+
var json = $"{{ \"tag_name\": \"{versioning.SemVer}\", \"target_commitish\": \"{versioning.BranchName}\", \"name\": \"{versioning.SemVer}\", \"body\": \"{ReleaseNotesAsJson()}\", \"draft\": false, \"prerelease\": false }}";
877928
var request = new System.Net.Http.HttpRequestMessage(new System.Net.Http.HttpMethod("Patch"), url); // $"https://api.github.com/repos/ThreeMammals/Ocelot/releases/{releaseId}");
878929
request.Content = new System.Net.Http.StringContent(json, System.Text.Encoding.UTF8, "application/json");
879930

docs/_static/overrides.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,15 @@ blockquote {
44
aside.footnote-list {
55
font-size: 0.9em;
66
}
7+
.img-valign-middle
8+
{
9+
vertical-align: middle;
10+
}
11+
.img-valign-bottom
12+
{
13+
vertical-align: bottom;
14+
}
15+
.img-valign-textbottom
16+
{
17+
vertical-align: text-bottom;
18+
}

docs/building/building.rst

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. role:: htm(raw)
2+
:format: html
3+
.. role:: pdf(raw)
4+
:format: latex pdflatex
15
.. _Ocelot: https://github.com/ThreeMammals/Ocelot
26
.. _Cake: https://cakebuild.net
37
.. _Bash: https://www.gnu.org/software/bash
@@ -114,22 +118,26 @@ You may need to adjust the platform flag depending on your system.
114118
With CI/CD
115119
----------
116120
.. _workflows: https://github.com/ThreeMammals/Ocelot/tree/main/.github/workflows
117-
.. _PR: https://github.com/ThreeMammals/Ocelot/blob/main/.github/workflows/pr.yml
118-
.. _Develop: https://github.com/ThreeMammals/Ocelot/blob/main/.github/workflows/develop.yml
119-
.. _Release: https://github.com/ThreeMammals/Ocelot/blob/main/.github/workflows/release.yml
121+
.. _PR: https://github.com/ThreeMammals/Ocelot/actions/workflows/pr.yml
122+
.. _Develop: https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml
123+
.. _Release: https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml
120124
.. _Coveralls: https://coveralls.io
121125
.. |ReleaseButton| image:: https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml/badge.svg
122-
:target: https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml
123-
:alt: Release Status
126+
:target: https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml
127+
:alt: Release Status
128+
:class: img-valign-textbottom
124129
.. |DevelopButton| image:: https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml/badge.svg
125-
:target: https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml
126-
:alt: Development Status
130+
:target: https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml
131+
:alt: Development Status
132+
:class: img-valign-textbottom
127133
.. |DevelopCoveralls| image:: https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=develop
128-
:target: https://coveralls.io/github/ThreeMammals/Ocelot?branch=develop
129-
:alt: Coveralls Status
134+
:target: https://coveralls.io/github/ThreeMammals/Ocelot?branch=develop
135+
:alt: Coveralls Status
136+
:class: img-valign-textbottom
130137
.. |ReleaseCoveralls| image:: https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=main
131-
:target: https://coveralls.io/github/ThreeMammals/Ocelot?branch=main
132-
:alt: Coveralls Status
138+
:target: https://coveralls.io/github/ThreeMammals/Ocelot?branch=main
139+
:alt: Coveralls Status
140+
:class: img-valign-textbottom
133141
.. _break2: http://break.do
134142

135143
| Folder: ./.github/`workflows`_
@@ -142,7 +150,9 @@ Starting from version `24.0`_, all pull requests, development commits, and relea
142150
There are three `workflows`_: one for pull requests (`PR`_), one for the ``develop`` branch (`Develop`_), and one for the ``main`` branch (`Release`_).
143151

144152
**Note**: Each workflow has a dedicated status badge in the `Ocelot README`_:
145-
the `Release`_ |ReleaseButton| button and the `Develop`_ |DevelopButton| button, with the `PR`_ status being published directly in a pull request under the "Checks" tab.
153+
the |ReleaseButton|:pdf:`\href{https://github.com/ThreeMammals/Ocelot/actions/workflows/release.yml}{Release}` button and
154+
the |DevelopButton|:pdf:`\href{https://github.com/ThreeMammals/Ocelot/actions/workflows/develop.yml}{Develop}` button,
155+
with the `PR`_ status being published directly in a pull request under the "Checks" tab.
146156

147157
The `PR`_ workflow will track code coverage using `Coveralls`_.
148158
After opening a pull request or submitting a new commit to a pull request, `Coveralls`_ will publish a short message with the current code coverage once the top commit is built.
@@ -164,11 +174,13 @@ Documentation
164174
.. _README: https://github.com/ThreeMammals/Ocelot/blob/main/docs/readme.md
165175
.. _Ocelot README: https://github.com/ThreeMammals/Ocelot/blob/main/README.md
166176
.. |ReleaseDocs| image:: https://readthedocs.org/projects/ocelot/badge/?version=latest&style=flat-square
167-
:target: https://app.readthedocs.org/projects/ocelot/builds/?version__slug=latest
168-
:alt: ReadTheDocs Status
177+
:target: https://app.readthedocs.org/projects/ocelot/builds/?version__slug=latest
178+
:alt: ReadTheDocs Status
179+
:class: img-valign-middle
169180
.. |DevelopDocs| image:: https://readthedocs.org/projects/ocelot/badge/?version=develop&style=flat-square
170-
:target: https://app.readthedocs.org/projects/ocelot/builds/?version__slug=develop
171-
:alt: ReadTheDocs Status
181+
:target: https://app.readthedocs.org/projects/ocelot/builds/?version__slug=develop
182+
:alt: ReadTheDocs Status
183+
:class: img-valign-middle
172184
.. _break3: http://break.do
173185

174186
| Folder: ./`docs`_

0 commit comments

Comments
 (0)