From 15fa891ca1261b8566ef86094a8ac51cbd55f6e7 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Thu, 23 Jan 2025 13:42:11 +0100 Subject: [PATCH 1/6] Create dedicated package to reference in ASP.NET Core projects --- GoogleSecrets.sln | 10 +++- ...s.cs => ConfigurationBuilderExtensions.cs} | 2 +- GoogleSecrets/GoogleSecrets.csproj | 7 +-- ...figuration.GoogleSecrets.AspNetCore.csproj | 19 ++++++++ .../WebApplicationBuilderExtensions.cs | 48 +++++++++++++++++++ 5 files changed, 80 insertions(+), 6 deletions(-) rename GoogleSecrets/{GoogleSecretsExtensions.cs => ConfigurationBuilderExtensions.cs} (96%) create mode 100644 Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj create mode 100644 Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs diff --git a/GoogleSecrets.sln b/GoogleSecrets.sln index 1f3c32e..f89ed2d 100644 --- a/GoogleSecrets.sln +++ b/GoogleSecrets.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31515.178 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoogleSecrets", "GoogleSecrets\GoogleSecrets.csproj", "{C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore", "Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore\Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj", "{19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}.Debug|Any CPU.Build.0 = Debug|Any CPU {C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}.Release|Any CPU.ActiveCfg = Release|Any CPU {C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}.Release|Any CPU.Build.0 = Release|Any CPU + {19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/GoogleSecrets/GoogleSecretsExtensions.cs b/GoogleSecrets/ConfigurationBuilderExtensions.cs similarity index 96% rename from GoogleSecrets/GoogleSecretsExtensions.cs rename to GoogleSecrets/ConfigurationBuilderExtensions.cs index fda2fef..adbad9d 100644 --- a/GoogleSecrets/GoogleSecretsExtensions.cs +++ b/GoogleSecrets/ConfigurationBuilderExtensions.cs @@ -6,7 +6,7 @@ /// /// The Google Secrets Extensions /// - public static class GoogleSecretsExtensions + public static class ConfigurationBuilderExtensions { /// /// Adds the google secrets. diff --git a/GoogleSecrets/GoogleSecrets.csproj b/GoogleSecrets/GoogleSecrets.csproj index 5a11381..60937ca 100644 --- a/GoogleSecrets/GoogleSecrets.csproj +++ b/GoogleSecrets/GoogleSecrets.csproj @@ -19,9 +19,10 @@ - - - + + + + diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj new file mode 100644 index 0000000..0f1e34e --- /dev/null +++ b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj @@ -0,0 +1,19 @@ + + + + net8.0 + enable + enable + true + true + + + + + + + + + + + \ No newline at end of file diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs new file mode 100644 index 0000000..b6d20d6 --- /dev/null +++ b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs @@ -0,0 +1,48 @@ +namespace Neolution.Extensions.Configuration.GoogleSecrets +{ + using System; + using Microsoft.AspNetCore.Builder; + + /// + /// WebBuilder extensions for Google Secrets + /// + public static class WebApplicationBuilderExtensions + { + /// + /// Gets the value of the environment variable of the google secrets project which decides where to load secrets from. + /// + /// + /// The string with the project name + /// + private static string GoogleSecretsProjectName => Environment.GetEnvironmentVariable("GOOGLE_SECRETS_PROJECT") ?? "default-project-goes-here"; + + /// + /// Gets a value indicating whether to load google secrets or not + /// + /// + /// true to load google secrets; otherwise not. + /// + private static bool LoadGoogleSecrets => bool.TryParse(Environment.GetEnvironmentVariable("LOAD_GOOGLE_SECRETS"), out var result) && result; + + /// + /// Adds the Google secrets. + /// + /// The builder. + public static void AddGoogleSecrets(this WebApplicationBuilder builder) + { + if (builder == null) + { + throw new ArgumentNullException(nameof(builder)); + } + + // Configure app configuration to add Google Secrets if applicable + if (LoadGoogleSecrets) + { + builder.Configuration.AddGoogleSecrets(options => + { + options.ProjectName = GoogleSecretsProjectName; + }); + } + } + } +} \ No newline at end of file From aa6583a858aa07d4f3228dda43cf8263d498d533 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Mon, 3 Feb 2025 10:37:36 +0100 Subject: [PATCH 2/6] fixes --- .../ConfigurationBuilderExtensions.cs | 24 ++++++++++++- GoogleSecrets/EnvironmentVariableNames.cs | 13 +++++++ ...nsions.Configuration.GoogleSecrets.csproj} | 0 ...figuration.GoogleSecrets.AspNetCore.csproj | 2 +- .../WebApplicationBuilderExtensions.cs | 35 +++++-------------- ...Extensions.Configuration.GoogleSecrets.sln | 11 ++++-- 6 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 GoogleSecrets/EnvironmentVariableNames.cs rename GoogleSecrets/{GoogleSecrets.csproj => Neolution.Extensions.Configuration.GoogleSecrets.csproj} (100%) rename GoogleSecrets.sln => Neolution.Extensions.Configuration.GoogleSecrets.sln (71%) diff --git a/GoogleSecrets/ConfigurationBuilderExtensions.cs b/GoogleSecrets/ConfigurationBuilderExtensions.cs index adbad9d..5a78bfe 100644 --- a/GoogleSecrets/ConfigurationBuilderExtensions.cs +++ b/GoogleSecrets/ConfigurationBuilderExtensions.cs @@ -9,7 +9,29 @@ public static class ConfigurationBuilderExtensions { /// - /// Adds the google secrets. + /// Adds the Google secrets to the . + /// If the GOOGLE_SECRETS_PROJECT environment variable is set, it will be used as the project name. + /// + /// The configuration. + /// The IConfigurationBuilder + /// options + public static IConfigurationBuilder AddGoogleSecrets(this IConfigurationBuilder configuration) + { + // Configure app configuration to add Google Secrets if environment variable is set + var googleSecretProject = Environment.GetEnvironmentVariable(EnvironmentVariableNames.GoogleSecretsProject); + if (!string.IsNullOrWhiteSpace(googleSecretProject)) + { + return AddGoogleSecrets(configuration, options => + { + options.ProjectName = googleSecretProject; + }); + } + + return AddGoogleSecrets(configuration, _ => { }); + } + + /// + /// Adds the Google secrets to the . /// /// The configuration. /// The options. diff --git a/GoogleSecrets/EnvironmentVariableNames.cs b/GoogleSecrets/EnvironmentVariableNames.cs new file mode 100644 index 0000000..14c68a9 --- /dev/null +++ b/GoogleSecrets/EnvironmentVariableNames.cs @@ -0,0 +1,13 @@ +namespace Neolution.Extensions.Configuration.GoogleSecrets +{ + /// + /// Contains the names of environment variables used for Google Secrets configuration. + /// + public static class EnvironmentVariableNames + { + /// + /// The name of the environment variable where the google secrets project id is stored. + /// + public const string GoogleSecretsProject = "GOOGLE_SECRETS_PROJECT"; + } +} \ No newline at end of file diff --git a/GoogleSecrets/GoogleSecrets.csproj b/GoogleSecrets/Neolution.Extensions.Configuration.GoogleSecrets.csproj similarity index 100% rename from GoogleSecrets/GoogleSecrets.csproj rename to GoogleSecrets/Neolution.Extensions.Configuration.GoogleSecrets.csproj diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj index 0f1e34e..5aac0ce 100644 --- a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj +++ b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs index b6d20d6..82d4dd7 100644 --- a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs +++ b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/WebApplicationBuilderExtensions.cs @@ -1,46 +1,29 @@ -namespace Neolution.Extensions.Configuration.GoogleSecrets +namespace Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore { using System; using Microsoft.AspNetCore.Builder; /// - /// WebBuilder extensions for Google Secrets + /// Google Secrets extensions for . /// public static class WebApplicationBuilderExtensions { /// - /// Gets the value of the environment variable of the google secrets project which decides where to load secrets from. - /// - /// - /// The string with the project name - /// - private static string GoogleSecretsProjectName => Environment.GetEnvironmentVariable("GOOGLE_SECRETS_PROJECT") ?? "default-project-goes-here"; - - /// - /// Gets a value indicating whether to load google secrets or not - /// - /// - /// true to load google secrets; otherwise not. - /// - private static bool LoadGoogleSecrets => bool.TryParse(Environment.GetEnvironmentVariable("LOAD_GOOGLE_SECRETS"), out var result) && result; - - /// - /// Adds the Google secrets. + /// Adds the Google secrets to the . + /// Uses the GOOGLE_SECRETS_PROJECT environment variable as the project name. /// /// The builder. public static void AddGoogleSecrets(this WebApplicationBuilder builder) { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } + ArgumentNullException.ThrowIfNull(builder); - // Configure app configuration to add Google Secrets if applicable - if (LoadGoogleSecrets) + // Configure app configuration to add Google Secrets if environment variable is set + var googleSecretProject = Environment.GetEnvironmentVariable(EnvironmentVariableNames.GoogleSecretsProject); + if (!string.IsNullOrWhiteSpace(googleSecretProject)) { builder.Configuration.AddGoogleSecrets(options => { - options.ProjectName = GoogleSecretsProjectName; + options.ProjectName = googleSecretProject; }); } } diff --git a/GoogleSecrets.sln b/Neolution.Extensions.Configuration.GoogleSecrets.sln similarity index 71% rename from GoogleSecrets.sln rename to Neolution.Extensions.Configuration.GoogleSecrets.sln index f89ed2d..595322a 100644 --- a/GoogleSecrets.sln +++ b/Neolution.Extensions.Configuration.GoogleSecrets.sln @@ -1,12 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.12.35707.178 d17.12 +VisualStudioVersion = 17.12.35707.178 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoogleSecrets", "GoogleSecrets\GoogleSecrets.csproj", "{C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neolution.Extensions.Configuration.GoogleSecrets", "GoogleSecrets\Neolution.Extensions.Configuration.GoogleSecrets.csproj", "{C7B9C660-1ABC-4DAE-B7C3-DB18810D3794}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore", "Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore\Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj", "{19D5426C-AF24-4CE1-9BD3-BEE2B77DD56B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A2F8802-860F-46EC-AE98-50D47A74FA91}" + ProjectSection(SolutionItems) = preProject + .github\workflows\ci.yml = .github\workflows\ci.yml + .github\workflows\create-release.yml = .github\workflows\create-release.yml + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU From a5bca574ca05f61aa5d7f63bcdb47e6fd67f6429 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Mon, 3 Feb 2025 14:55:01 +0100 Subject: [PATCH 3/6] Add changelog entry --- .github/workflows/ci.yml | 6 +-- .github/workflows/create-release.yml | 47 +++++++++++-------- CHANGELOG.md | 7 ++- ...Extensions.Configuration.GoogleSecrets.sln | 1 + 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd0bd4..9d509d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,13 +42,11 @@ jobs: - uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.x + dotnet-version: 8.x - run: dotnet build -c Release - - run: dotnet pack -c Release --no-build --no-restore -o ./artifacts - - - run: mv ./artifacts/*.nupkg ./artifacts/Neolution.Extensions.Configuration.GoogleSecrets.${{ github.run_id }}-${{ github.run_attempt }}.nupkg + - run: dotnet pack -c Release --no-build --no-restore -o ./artifacts /p:PackageVersion=$(date -d "${GITHUB_RUN_TIMESTAMP}" "+%Y.%-m.%-d")-ci.${{ github.run_attempt }}${{ github.run_id }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 2868059..3a283d7 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -3,23 +3,29 @@ name: Create Release on: workflow_dispatch: inputs: - version_type: + versioning_phase: type: choice - description: Semantic Version Type + description: Versioning Phase + default: stable options: - - automatic + - alpha + - beta + - rc + - stable + + bump_version_number: + type: choice + description: Bump Version Number + default: consecutive + options: + - consecutive - patch - minor - major - pre_release: - type: choice - description: Stage - options: - - stable - - rc - - beta - - alpha + is_dry_run: + type: boolean + description: Dry Run jobs: release-it: @@ -43,27 +49,30 @@ jobs: git config user.name "GitHub Release Bot" git config user.email release-bot@neolution.ch - - name: install @release-it/keep-a-changelog - run: yarn add release-it @release-it/keep-a-changelog @neolution-ch/release-it-dotnet-plugin + - name: install release-it with plugins + run: npm install -g release-it @release-it/keep-a-changelog - name: run release-it run: | params=() - if [[ ${{ github.event.inputs.version_type }} != "automatic" ]]; then - params+=(${{ github.event.inputs.version_type }}) + if [[ ${{ github.event.inputs.bump_version_number }} != "consecutive" ]]; then + params+=(${{ github.event.inputs.bump_version_number }}) fi - if [[ ${{ github.event.inputs.pre_release }} != "stable" ]]; then - params+=(--preRelease=${{ github.event.inputs.pre_release }}) + if [[ ${{ github.event.inputs.versioning_phase }} != "stable" ]]; then + params+=(--preRelease=${{ github.event.inputs.versioning_phase }}) params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased) params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest) fi + if [[ ${{ github.event.inputs.is_dry_run }} == "true" ]]; then + params+=(--dry-run) + fi + params+=(--ci) - params+=(--plugins.@neolution-ch/release-it-dotnet-plugin.nugetApiKey=${{ secrets.NUGET_API_KEY_NEOLUTION }}) echo "command: release-it ${params[@]}" - yarn release-it "${params[@]}" + release-it "${params[@]}" env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/CHANGELOG.md b/CHANGELOG.md index decedcf..6b9cd59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,12 @@ and adheres to a project-specific [Versioning](/README.md). ## [Unreleased] -### Dependabot +### Added + +- Convention to load Google Secrets project name from environment variable `GOOGLE_SECRETS_PROJECT` if not specified in the options. +- New package `Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore` to reference in ASP.NET Core projects. + +### Changed - Update GitHub Actions to use the latest versions of the actions diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.sln b/Neolution.Extensions.Configuration.GoogleSecrets.sln index 595322a..c34e5de 100644 --- a/Neolution.Extensions.Configuration.GoogleSecrets.sln +++ b/Neolution.Extensions.Configuration.GoogleSecrets.sln @@ -9,6 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neolution.Extensions.Config EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A2F8802-860F-46EC-AE98-50D47A74FA91}" ProjectSection(SolutionItems) = preProject + CHANGELOG.md = CHANGELOG.md .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\create-release.yml = .github\workflows\create-release.yml README.md = README.md From e76fec637fec86b1adbb9933491b3c7fcb633a95 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Mon, 3 Feb 2025 16:38:40 +0100 Subject: [PATCH 4/6] fix release workflow --- .release-it.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.release-it.json b/.release-it.json index 1bd4cd6..233c8dd 100644 --- a/.release-it.json +++ b/.release-it.json @@ -15,11 +15,6 @@ "addVersionUrl": true, "addUnreleased": true, "strictLatest": false - }, - "@neolution-ch/release-it-dotnet-plugin": { - "csprojFile": "./GoogleSecrets/GoogleSecrets.csproj", - "buildConfiguration": "Release", - "nugetApiKey": "overridden in GitHub workflow" } }, "hooks": { From 96c16229f072142e4056c24a0fa4db2971e53073 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Tue, 4 Feb 2025 12:17:07 +0100 Subject: [PATCH 5/6] Add cd-production.yml --- .github/workflows/cd-production.yml | 39 +++++++++++++++++++++++++++++ .github/workflows/ci.yml | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cd-production.yml diff --git a/.github/workflows/cd-production.yml b/.github/workflows/cd-production.yml new file mode 100644 index 0000000..324dd15 --- /dev/null +++ b/.github/workflows/cd-production.yml @@ -0,0 +1,39 @@ +name: Publish NuGet package + +on: + release: + types: [published] + +env: + ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json + BUILD_CONFIGURATION: "Release" + DOTNET_VERSION: "8.x" + +jobs: + build-pack-push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + source-url: ${{ env.ARTIFACTS_FEED_URL }} + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} + + - name: Determine version for NuGet package + run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV + + - name: Build and pack + run: | + dotnet restore + dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} -p:Version=$NUGET_VERSION + dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore --no-build -p:PackageVersion=$NUGET_VERSION + + - name: Push NuGet package + run: echo "dotnet nuget push -k $NUGET_AUTH_TOKEN **/bin/Release/*.nupkg" + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d509d0..e0ea0fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - run: dotnet build -c Release - - run: dotnet pack -c Release --no-build --no-restore -o ./artifacts /p:PackageVersion=$(date -d "${GITHUB_RUN_TIMESTAMP}" "+%Y.%-m.%-d")-ci.${{ github.run_attempt }}${{ github.run_id }} + - run: dotnet pack -c Release --no-build --no-restore -o ./artifacts -p:PackageVersion=$(date -d "${GITHUB_RUN_TIMESTAMP}" "+%Y.%-m.%-d")-ci.${{ github.run_attempt }}${{ github.run_id }} - name: Upload artifact uses: actions/upload-artifact@v4 From db954688f21aabd44cdcaffb3a7d7966e2a7fa5a Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Tue, 4 Feb 2025 12:22:38 +0100 Subject: [PATCH 6/6] fix cd-production --- .github/workflows/cd-production.yml | 8 ++++---- ...tensions.Configuration.GoogleSecrets.AspNetCore.csproj | 1 - Neolution.Extensions.Configuration.GoogleSecrets.sln | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd-production.yml b/.github/workflows/cd-production.yml index 324dd15..a1da529 100644 --- a/.github/workflows/cd-production.yml +++ b/.github/workflows/cd-production.yml @@ -25,15 +25,15 @@ jobs: NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} - name: Determine version for NuGet package - run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV + run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV - name: Build and pack run: | dotnet restore - dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} -p:Version=$NUGET_VERSION - dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore --no-build -p:PackageVersion=$NUGET_VERSION + dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore -p:Version=$NUGET_VERSION + dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --no-restore -p:PackageVersion=$NUGET_VERSION - name: Push NuGet package - run: echo "dotnet nuget push -k $NUGET_AUTH_TOKEN **/bin/Release/*.nupkg" + run: dotnet nuget push -k $NUGET_AUTH_TOKEN **/bin/Release/*.nupkg env: NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj index 5aac0ce..77e9ed9 100644 --- a/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj +++ b/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore/Neolution.Extensions.Configuration.GoogleSecrets.AspNetCore.csproj @@ -4,7 +4,6 @@ net8.0 enable enable - true true diff --git a/Neolution.Extensions.Configuration.GoogleSecrets.sln b/Neolution.Extensions.Configuration.GoogleSecrets.sln index c34e5de..2f70b2e 100644 --- a/Neolution.Extensions.Configuration.GoogleSecrets.sln +++ b/Neolution.Extensions.Configuration.GoogleSecrets.sln @@ -9,6 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neolution.Extensions.Config EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A2F8802-860F-46EC-AE98-50D47A74FA91}" ProjectSection(SolutionItems) = preProject + .github\workflows\cd-production.yml = .github\workflows\cd-production.yml CHANGELOG.md = CHANGELOG.md .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\create-release.yml = .github\workflows\create-release.yml