From d22baf091c762d60a555848f4b3835a340fb27b2 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Fri, 19 May 2023 18:54:58 +0100 Subject: [PATCH 1/4] RELEASES: v2.2.0.0 --- .github/workflows/dotnet.yml | 12 ++++++------ ADotNet.Infrastructure.Build/Program.cs | 4 ++-- ADotNet/ADotNet.csproj | 20 ++++++++++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9fad91a..70a2018 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -47,13 +47,13 @@ jobs: needs: - build if: >- - needs.build.result == 'success' && + needs.build.result == 'success' && - github.event.pull_request.merged && + github.event.pull_request.merged && - github.event.pull_request.base.ref == 'master' && + github.event.pull_request.base.ref == 'master' && - startsWith(github.event.pull_request.title, 'RELEASES:') && + startsWith(github.event.pull_request.title, 'RELEASES:') && contains(github.event.pull_request.labels.*.name, 'RELEASES') steps: @@ -75,7 +75,7 @@ jobs: - name: Authenticate with GitHub uses: actions/checkout@v3 with: - token: ${{ secrets.GITHUB_PAT_FOR_TAGGING }} + token: ${{ secrets.PAT_FOR_TAGGING }} - name: Add Release Tag run: |- git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}" @@ -83,7 +83,7 @@ jobs: - name: Create Release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_PAT_FOR_TAGGING }} + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }} with: tag_name: v${{ steps.extract_version.outputs.version_number }} release_name: Release - v${{ steps.extract_version.outputs.version_number }} diff --git a/ADotNet.Infrastructure.Build/Program.cs b/ADotNet.Infrastructure.Build/Program.cs index dfdc0ec..346d7c5 100644 --- a/ADotNet.Infrastructure.Build/Program.cs +++ b/ADotNet.Infrastructure.Build/Program.cs @@ -132,7 +132,7 @@ static void Main(string[] args) Name = "Authenticate with GitHub", With = new Dictionary { - { "token", "${{ secrets.PAT_FOR_TAGGING }}" } + { "token", "${{ secrets.GITHUB_PAT_FOR_TAGGING }}" } } }, @@ -151,7 +151,7 @@ static void Main(string[] args) EnvironmentVariables = new Dictionary { - { "GITHUB_TOKEN", "${{ secrets.PAT_FOR_TAGGING }}" } + { "GITHUB_TOKEN", "${{ secrets.GITHUB_PAT_FOR_TAGGING }}" } }, With = new Dictionary diff --git a/ADotNet/ADotNet.csproj b/ADotNet/ADotNet.csproj index d475a49..118f496 100644 --- a/ADotNet/ADotNet.csproj +++ b/ADotNet/ADotNet.csproj @@ -3,18 +3,26 @@ netstandard2.0;netstandard2.1 11.0 - Copyright (c) Hassan Habib & Shri Humrudha + Copyright (c) Hassan Habib & Shri Humrudha & Christo du Toit ADotNet is a dot net library to help engineers develop their build and release pipelines in C# without having to use YAML or any other technology. - Hassan Habib & Shri Humrudha + Hassan Habib & Shri Humrudha & Christo du Toit ADotNet.png https://github.com/hassanhabib/ADotNet git ADO YAML AzureDevOps - Add Windows-Latest VM + RunTask + Environment Variables + + Adding Release Tag, GitHub Release, and NuGet Package Push Support + + We are excited to announce the addition of new functionality to our software, + enabling developers to enhance their release management process. + With this update, you can now easily add release tags, create GitHub releases, + and push packages to NuGet for release builds. + Upgrade today to leverage these powerful features and improve your development workflow. + True - 2.1.1.3 - 2.1.1.3 - 2.1.1.3 + 2.2.0.0 + 2.2.0.0 + 2.2.0.0 License.txt True https://github.com/hassanhabib/ADotNet From 544528aeba58cc1b94c1c05777615e3efe8627a6 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Mon, 22 May 2023 11:15:22 +0100 Subject: [PATCH 2/4] CODE RUB: Updated project files to explicitly define which ones should generate packages. --- .../ADotNet.Infrastructure.Build.csproj | 15 ++++--- .../ADotNet.Tests.Console.csproj | 15 ++++--- AdoNet.Tests.Unit/ADotNet.Tests.Unit.csproj | 45 +++++++++---------- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/ADotNet.Infrastructure.Build/ADotNet.Infrastructure.Build.csproj b/ADotNet.Infrastructure.Build/ADotNet.Infrastructure.Build.csproj index fbf4a0f..3b8babe 100644 --- a/ADotNet.Infrastructure.Build/ADotNet.Infrastructure.Build.csproj +++ b/ADotNet.Infrastructure.Build/ADotNet.Infrastructure.Build.csproj @@ -1,12 +1,13 @@ - - Exe - net7.0 - + + Exe + net7.0 + false + - - - + + + diff --git a/AdoNet.Tests.Console/ADotNet.Tests.Console.csproj b/AdoNet.Tests.Console/ADotNet.Tests.Console.csproj index fbf4a0f..3b8babe 100644 --- a/AdoNet.Tests.Console/ADotNet.Tests.Console.csproj +++ b/AdoNet.Tests.Console/ADotNet.Tests.Console.csproj @@ -1,12 +1,13 @@ - - Exe - net7.0 - + + Exe + net7.0 + false + - - - + + + diff --git a/AdoNet.Tests.Unit/ADotNet.Tests.Unit.csproj b/AdoNet.Tests.Unit/ADotNet.Tests.Unit.csproj index ea81ee1..d6a86a4 100644 --- a/AdoNet.Tests.Unit/ADotNet.Tests.Unit.csproj +++ b/AdoNet.Tests.Unit/ADotNet.Tests.Unit.csproj @@ -1,29 +1,28 @@ - - net7.0 + + net7.0 + false + - false - + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - + + + From 778e7531a183f9dad8261d155850fdbfe0739b11 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Mon, 22 May 2023 21:24:42 +0100 Subject: [PATCH 3/4] CODE RUB: Updated PAT secret name --- .github/workflows/dotnet.yml | 4 ++-- ADotNet.Infrastructure.Build/Program.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 70a2018..aa2cdd9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -75,7 +75,7 @@ jobs: - name: Authenticate with GitHub uses: actions/checkout@v3 with: - token: ${{ secrets.PAT_FOR_TAGGING }} + token: ${{ secrets.NUGET_ACCESS }} - name: Add Release Tag run: |- git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}" @@ -83,7 +83,7 @@ jobs: - name: Create Release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }} + GITHUB_TOKEN: ${{ secrets.NUGET_ACCESS }} with: tag_name: v${{ steps.extract_version.outputs.version_number }} release_name: Release - v${{ steps.extract_version.outputs.version_number }} diff --git a/ADotNet.Infrastructure.Build/Program.cs b/ADotNet.Infrastructure.Build/Program.cs index 346d7c5..c595dee 100644 --- a/ADotNet.Infrastructure.Build/Program.cs +++ b/ADotNet.Infrastructure.Build/Program.cs @@ -132,7 +132,7 @@ static void Main(string[] args) Name = "Authenticate with GitHub", With = new Dictionary { - { "token", "${{ secrets.GITHUB_PAT_FOR_TAGGING }}" } + { "token", "${{ secrets.NUGET_ACCESS }}" } } }, @@ -151,7 +151,7 @@ static void Main(string[] args) EnvironmentVariables = new Dictionary { - { "GITHUB_TOKEN", "${{ secrets.GITHUB_PAT_FOR_TAGGING }}" } + { "GITHUB_TOKEN", "${{ secrets.NUGET_ACCESS }}" } }, With = new Dictionary From 87b5d9a2f3e6ab3e081d6d343aa6fcc57169f5aa Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Mon, 22 May 2023 21:30:23 +0100 Subject: [PATCH 4/4] CODE RUB: Updated variable names --- .github/workflows/dotnet.yml | 6 +++--- ADotNet.Infrastructure.Build/Program.cs | 4 ++-- .../GithubPipelines/DotNets/Tasks/NugetPushTask.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index aa2cdd9..9513f5e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -75,7 +75,7 @@ jobs: - name: Authenticate with GitHub uses: actions/checkout@v3 with: - token: ${{ secrets.NUGET_ACCESS }} + token: ${{ secrets.PAT_FOR_TAGGING }} - name: Add Release Tag run: |- git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}" @@ -83,7 +83,7 @@ jobs: - name: Create Release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.NUGET_ACCESS }} + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }} with: tag_name: v${{ steps.extract_version.outputs.version_number }} release_name: Release - v${{ steps.extract_version.outputs.version_number }} @@ -113,4 +113,4 @@ jobs: - name: Pack NuGet Package run: dotnet pack --configuration Release - name: Push NuGet Package - run: dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ACCESS }} diff --git a/ADotNet.Infrastructure.Build/Program.cs b/ADotNet.Infrastructure.Build/Program.cs index c595dee..dfdc0ec 100644 --- a/ADotNet.Infrastructure.Build/Program.cs +++ b/ADotNet.Infrastructure.Build/Program.cs @@ -132,7 +132,7 @@ static void Main(string[] args) Name = "Authenticate with GitHub", With = new Dictionary { - { "token", "${{ secrets.NUGET_ACCESS }}" } + { "token", "${{ secrets.PAT_FOR_TAGGING }}" } } }, @@ -151,7 +151,7 @@ static void Main(string[] args) EnvironmentVariables = new Dictionary { - { "GITHUB_TOKEN", "${{ secrets.NUGET_ACCESS }}" } + { "GITHUB_TOKEN", "${{ secrets.PAT_FOR_TAGGING }}" } }, With = new Dictionary diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/NugetPushTask.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/NugetPushTask.cs index c3908a6..378ddef 100644 --- a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/NugetPushTask.cs +++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/NugetPushTask.cs @@ -11,6 +11,6 @@ namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks public class NugetPushTask : GithubTask { [YamlMember(Order = 1)] - public string Run = "dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}"; + public string Run = "dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ACCESS }}"; } }