Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
permissions:
contents: write
packages: write
id-token: write # NuGet.org Trusted Publishing (OIDC) için gerekli

jobs:
build-and-publish:
Expand Down Expand Up @@ -47,7 +48,7 @@
- name: Install ASP.NET Core runtime (required by PostSharp weaving)
shell: bash
run: |
curl -sSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh

Check warning on line 51 in .github/workflows/publish-nuget.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Not enforcing HTTPS here might allow for redirections to insecure websites. Make sure it is safe here.

See more on https://sonarcloud.io/project/issues?id=burgan-tech_aether&issues=AaAAJMnrbXyR-C0IChUH&open=AaAAJMnrbXyR-C0IChUH&pullRequest=94
chmod +x dotnet-install.sh
./dotnet-install.sh --runtime aspnetcore --channel 10.0 --install-dir "$DOTNET_ROOT"
dotnet --list-runtimes
Expand Down Expand Up @@ -214,18 +215,32 @@
path: packages/
retention-days: 30

# Trusted Publishing: GitHub'ın OIDC token'ı NuGet.org'a gönderilir ve
# 1 saat geçerli, tek kullanımlık kısa ömürlü bir API key alınır.
# Anahtar kısa ömürlü olduğu için bu adım push'tan hemen önce çalışmalıdır.
# NuGet.org policy'si bu workflow dosya adına (publish-nuget.yml) bağlıdır;
# dosyayı yeniden adlandırırsanız policy'yi de güncellemek gerekir.
- name: NuGet login (OIDC → short-lived API key)
id: nuget-login
uses: NuGet/login@v1

Check failure on line 225 in .github/workflows/publish-nuget.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=burgan-tech_aether&issues=AaAAJMnrbXyR-C0IChUI&open=AaAAJMnrbXyR-C0IChUI&pullRequest=94
with:
user: ${{ secrets.NUGET_USER }}

- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
run: |
# Check if API key is configured
# Verify the OIDC token exchange produced a key
if [ -z "$NUGET_API_KEY" ]; then
echo "❌ Error: NUGET_API_KEY secret is not configured"
echo "Please add your NuGet.org API key as a repository secret named 'NUGET_API_KEY'"
echo "Get your API key from: https://www.nuget.org/account/apikeys"
echo "❌ Error: Trusted Publishing did not return an API key"
echo "Checklist:"
echo " - NUGET_USER secret must be your nuget.org profile name (not e-mail)"
echo " - nuget.org Trusted Publishing policy must match:"
echo " owner=${{ github.repository_owner }}, repo=${{ github.event.repository.name }}, workflow=publish-nuget.yml"
echo " - Job must have 'id-token: write' permission"
exit 1
fi

echo "🚀 Publishing packages to NuGet.org..."

FORCE_FLAG=""
Expand Down
Loading