Files
radzen-blazor/.github/workflows/deploy.yml
Atanas Korchev cf4a3feded Speed up website deploy: generate API docs from the Radzen.Blazor package
The Docker deploy compiled Radzen.Blazor from source (3 target frameworks
plus Sass and Terser) only to feed the API reference generator, even though
the deployed site ships the published Radzen.Blazor NuGet package. Generate
the API docs and llms.txt from that same package and drop the source build.

- Radzen.Blazor.Api: reference the Radzen.Blazor package in Release (source
  project in Debug), like RadzenBlazorDemos already does; the generator reads
  the package dll/xml.
- RadzenBlazorDemos: GenerateLlmsTxt reads the package XML in Release so the
  LLM docs keep their API descriptions.
- Dockerfile: restore for Release, drop the Radzen.Blazor source build,
  generate API pages from the restored package, set NUGET_XMLDOC_MODE=none so
  the package XML is extracted.
- Add .dockerignore to keep .git/bin/obj out of the build context.
- deploy.yml: shallow checkout (fetch-depth 1).
2026-06-24 20:25:11 +03:00

92 lines
2.6 KiB
YAML

name: Deploy to blazor.radzen.com
on:
workflow_dispatch:
concurrency:
group: blazor-radzen-prod
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Generate static assets
run: |
dotnet run --project RadzenBlazorDemos.Tools -- \
RadzenBlazorDemos.Host/wwwroot \
RadzenBlazorDemos/Pages \
RadzenBlazorDemos/Services/ExampleService.cs
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute image tag (timestamp)
id: meta
run: |
TAG=$(date -u +"%Y%m%d%H%M%S")
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${TAG}"
echo "image=$IMAGE" >> "$GITHUB_OUTPUT"
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.image }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Set Dokku config
run: |
eval "$(ssh-agent -s)"
echo "${{ secrets.DOKKU_SSH_PRIVATE_KEY }}" | ssh-add -
REMOTE="${{ secrets.DOKKU_REPO }}"
# Extract app name (last path segment) and host, handling both
# ssh://dokku@host:port/app and dokku@host:app formats
APP_NAME=$(echo "$REMOTE" | sed 's|.*/||')
HOST=$(echo "$REMOTE" | sed 's|.*@||;s|[:/].*||')
ssh -o StrictHostKeyChecking=no "dokku@${HOST}" config:set --no-restart "$APP_NAME" "GoogleMaps__ApiKey=${{ secrets.GOOGLE_MAPS_API_KEY }}"
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: ${{ secrets.DOKKU_REPO }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
deploy_docker_image: ${{ steps.meta.outputs.image }}
- name: Prune GHCR versions (keep 1)
uses: actions/delete-package-versions@v5
with:
package-name: radzen-blazor
package-type: container
min-versions-to-keep: 1
delete-only-pre-release-versions: false