Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Deployment patterns for .NET applications in GitHub Actions: GitHub Pages deployment for documentation sites
(Starlight/Docusaurus), container registry push patterns for GHCR and ACR, Azure Web Apps deployment via
azure/webapps-deploy, GitHub Environments with protection rules for staged rollouts, and rollback strategies for
failed deployments.
Version assumptions: GitHub Actions workflow syntax v2. azure/webapps-deploy@v3 for Azure App Service.
azure/login@v2 for Azure credential management. GitHub Environments for deployment gates.
Scope
Azure Web Apps deployment via azure/webapps-deploy
GitHub Pages deployment for documentation sites
Container registry push patterns for GHCR and ACR
GitHub Environments with protection rules
Rollback strategies for failed deployments
Out of scope
Container orchestration (Kubernetes, Docker Compose) -- see [skill:dotnet-container-deployment]
Container image authoring -- see [skill:dotnet-containers]
NuGet publishing and container builds -- see [skill:dotnet-gha-publish]
Starter CI templates -- see [skill:dotnet-add-ci]
Azure DevOps deployment -- see [skill:dotnet-ado-unique] and [skill:dotnet-ado-publish]
CLI release pipelines -- see [skill:dotnet-cli-release-pipeline]
Cross-references: [skill:dotnet-container-deployment] for container orchestration patterns, [skill:dotnet-containers]
for container image authoring, [skill:dotnet-add-ci] for starter CI templates, [skill:dotnet-cli-release-pipeline] for
CLI-specific release automation.
GitHub Pages Deployment for Documentation
Static Site Deployment (Starlight/Docusaurus)
Deploy a .NET project's documentation site to GitHub Pages:
Use deployment slots for zero-downtime deployments with pre-swap validation:
```yaml
-
name:
Deploy
to
staging
slot
uses:
azure/webapps-deploy@v3
with:
app-name:
myapp-production
slot-name:
staging
package:
./publish
-
name:
Validate
staging
slot
shell:
bash
run:
|
set -euo pipefail
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
https://myapp-production-staging.azurewebsites.net/healthz)
if [ "$HTTP_STATUS" != "200" ]; then
echo "Health check failed with status $HTTP_STATUS"
exit 1
fi
-
name:
Swap
slots
uses:
azure/cli@v2
with:
inlineScript:
|
az webapp deployment slot swap \
--resource-group myapp-rg \
--name myapp-production \
--slot staging \
--target-slot production
```text
### OIDC Authentication (Federated Credentials)
Use OIDC for passwordless Azure authentication instead of service principal secrets:
```yaml
-
name:
Login
to
Azure
(OIDC)
uses:
azure/login@v2
with:
client-id:
${{
secrets.AZURE_CLIENT_ID
}}
tenant-id:
${{
secrets.AZURE_TENANT_ID
}}
subscription-id:
${{
secrets.AZURE_SUBSCRIPTION_ID
}}
```text
OIDC
requires
configuring
a
federated
credential
in
Azure
AD
that
trusts
the
GitHub
Actions
OIDC
provider.
No
client
secret
is
stored
in
GitHub
Secrets.
---
## GitHub Environments with Protection Rules
### Multi-Environment Pipeline
```yaml
jobs:
build:
runs-on:
ubuntu-latest
steps:
-
uses:
actions/checkout@v4
-
run:
dotnet
publish
-c
Release
-o
./publish
-
uses:
actions/upload-artifact@v4
with:
name:
app
path:
./publish
deploy-dev:
needs:
build
runs-on:
ubuntu-latest
environment:
development
steps:
-
uses:
actions/download-artifact@v4
with:
name:
app
-
run:
echo
"Deploy to dev"
deploy-staging:
needs:
deploy-dev
runs-on:
ubuntu-latest
environment:
name:
staging
url:
https://staging.example.com
steps:
-
uses:
actions/download-artifact@v4
with:
name:
app
-
run:
echo
"Deploy to staging"
deploy-production:
needs:
deploy-staging
runs-on:
ubuntu-latest
environment:
name:
production
url:
https://example.com
steps:
-
uses:
actions/download-artifact@v4
with:
name:
app
-
run:
echo
"Deploy to production"
```text
### Protection Rule Configuration
Configure
in
GitHub
Settings
>
Environments for each environment:
|
Environment
|
Required
Reviewers
|
Wait
Timer
|
Branch
Policy
|
|
-----------
|
------------------
|
----------
|
-------------------
|
|
development
|
None
|
None
|
Any
branch
|
|
staging
|
1
reviewer
|
None
|
`main`,
`release/*`
|
|
production
|
2
reviewers
|
15
minutes
|
`main`
only
|
### Environment-Specific Secrets and Variables
Each environment can override repository-level secrets:
```yaml
jobs:
deploy:
environment:
production
runs-on:
ubuntu-latest
steps:
-
name:
Deploy
with
environment-specific
config
env:
# Resolves to the production environment's secret, not the repo-level one
DB_CONNECTION:
${{
secrets.DB_CONNECTION_STRING
}}
APP_URL:
${{
vars.APP_URL
}}
run:
|
set -euo pipefail
echo "Deploying to $APP_URL"
```text
---
## Rollback Patterns
### Revert Deployment
Re-deploy the previous known-good version on failure:
```yaml
jobs:
deploy:
runs-on:
ubuntu-latest
environment:
production
steps:
-
name:
Deploy
new
version
id:
deploy
continue-on-error:
true
run:
|
set -euo pipefail
# Deploy logic here
./deploy.sh --version ${{ github.sha }}
-
name:
Health
check
id:
health
if:
steps.deploy.outcome
==
'success'
continue-on-error:
true
shell:
bash
run:
|
set -euo pipefail
for i in {1..5}; do
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://example.com/healthz)
if [ "$HTTP_STATUS" = "200" ]; then
echo "Health check passed"
exit 0
fi
sleep 10
done
echo "Health check failed after 5 attempts"
exit 1
-
name:
Rollback
on
failure
if:
steps.deploy.outcome
==
'failure'
||
steps.health.outcome
==
'failure'
run:
|
set -euo pipefail
echo "Rolling back to previous version"
# Re-deploy the last known-good artifact
./deploy.sh --version ${{ github.event.before }}
-
name:
Fail
the
job
if
rollback
was
needed
if:
steps.deploy.outcome
==
'failure'
||
steps.health.outcome
==
'failure'
run:
exit
1
```text
### Azure Deployment Slot Rollback
Swap back to the previous slot on health check failure:
```yaml
-
name:
Swap
to
production
id:
swap
uses:
azure/cli@v2
with:
inlineScript:
|
az webapp deployment slot swap \
--resource-group myapp-rg \
--name myapp-production \
--slot staging \
--target-slot production
-
name:
Post-swap
health
check
id:
post-health
continue-on-error:
true
shell:
bash
run:
|
set -euo pipefail
sleep 30 # allow swap to stabilize
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://myapp.azurewebsites.net/healthz)
if [ "$HTTP_STATUS" != "200" ]; then
echo "Post-swap health check failed"
exit 1
fi
-
name:
Rollback
swap
on
failure
if:
steps.post-health.outcome
==
'failure'
uses:
azure/cli@v2
with:
inlineScript:
|
az webapp deployment slot swap \
--resource-group myapp-rg \
--name myapp-production \
--slot staging \
--target-slot production
echo "Rolled back: swapped staging back to production"