Skip to content

release: v5.9.6 (merge develop) #7

release: v5.9.6 (merge develop)

release: v5.9.6 (merge develop) #7

Workflow file for this run

name: Release
# Packs the Downloader NuGet package and publishes it to nuget.org + GitHub Packages, then attaches
# the .nupkg/.snupkg to the GitHub Release for this tag. Triggered by scripts/release.sh (which bumps
# <Version>/<PackageReleaseNotes>, merges develop -> master, and pushes the vX.Y.Z tag) or manually.
#
# Secrets required (repo settings -> Secrets and variables -> Actions):
# NUGET_API_KEY - nuget.org API key
# PACKAGE_TOKEN - a PAT with the `write:packages` scope, for GitHub Packages
on:
push:
tags: [ 'v*' ]
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
# .NET 11 is still preview-only, so it needs its own step: dotnet-quality
# applies to every version in a step, and 8/9/10 must stay on GA quality.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 11.0.x
dotnet-quality: preview
- name: Test (Release)
run: dotnet test src/Downloader.Test/Downloader.Test.csproj -c Release
publish:
name: Pack + publish NuGet package
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
# .NET 11 is still preview-only, so it needs its own step: dotnet-quality
# applies to every version in a step, and 8/9/10 must stay on GA quality.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 11.0.x
dotnet-quality: preview
- name: Pack (Release)
run: dotnet pack src/Downloader/Downloader.csproj -c Release -o src/Downloader/bin/nupkg/
# Create the GitHub Release (with the packages attached) BEFORE pushing to the feeds, so that a
# feed-push failure never leaves the tag without a release. scripts/release.sh then overwrites
# the body with curated notes; the `notes` job is the safety net for tags pushed by hand.
- name: Create GitHub Release + attach packages
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
src/Downloader/bin/nupkg/*.nupkg
fail_on_unmatched_files: false
# --no-symbols: the package embeds its Source Link PDB (DebugType=embedded) and no separate symbol
# package is built, so never attempt a symbol-server push (nuget.org rejects empty symbol packages).
- name: Push to nuget.org
run: |
dotnet nuget push "src/Downloader/bin/nupkg/*.nupkg" \
--source https://api.nuget.org/v3/index.json \
--api-key "${{ secrets.NUGET_API_KEY }}" \
--no-symbols \
--skip-duplicate
# GitHub Packages has no symbol server and rejects .snupkg — push the package only (--no-symbols)
# so dotnet does not also try to upload the sibling symbols package and fail the step.
- name: Push to GitHub Packages
run: |
dotnet nuget push "src/Downloader/bin/nupkg/*.nupkg" \
--source https://nuget.pkg.github.com/bezzad/index.json \
--api-key "${{ secrets.PACKAGE_TOKEN }}" \
--no-symbols \
--skip-duplicate
notes:
name: Ensure release notes
needs: publish
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fill notes if empty
env:
GH_TOKEN: ${{ github.token }}
run: |
body=$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json body --jq '.body' 2>/dev/null || true)
if [ -z "$body" ]; then
notes=$(gh api "repos/$GITHUB_REPOSITORY/releases/generate-notes" -f tag_name="$GITHUB_REF_NAME" --jq '.body')
gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --notes "$notes"
echo "Filled auto-generated notes."
else
echo "Release already has notes — leaving them as-is."
fi