.github/workflow-templates/dotnet-eb-deploy.yml
Adam Moussa 8c3487b6bc
ci(cd-dotnet-eb): add reusable CD workflow for .NET on Elastic Beanstalk
Publishes a .NET project, packages the output as a bundle, uploads it,
creates an Elastic Beanstalk application version, and updates an
existing environment using OIDC credentials. It deploys to an
environment; it never creates one.

Two deliberate departures from the existing cd-* reusables:

- A concurrency group keyed on application+environment, with
  cancel-in-progress false, so two pushes cannot deploy over each other
  and an in-flight deploy is never aborted midway. The existing cd-*
  workflows have no concurrency group at all.
- No input or secret is interpolated into a run: body; everything goes
  through env-var indirection. The repo's actionlint runs with
  shellcheck disabled, so this is a hand-maintained property.

The post-deploy check polls rather than using the CLI waiter
"elasticbeanstalk wait environment-updated": that waiter is hardcoded to
20 attempts x 20s and the CLI cannot extend it, so a slower rolling
deploy would fail the job while the deployment was still healthy. The
timeout is an input instead. The check asserts status, health and the
running version label -- Elastic Beanstalk reports a rolled-back deploy
as a healthy Ready environment running the previous version, so without
the version assertion the job would go green over a failed deploy.

Replaces the malformed cd-dotnet-eb.yaml.yml stub (doubled extension,
empty on:/jobs:). Adds the matching starter template and README entries.
2026-07-27 17:25:23 -04:00

23 lines
1 KiB
YAML

name: Deploy (.NET Elastic Beanstalk)
on:
push:
branches: [main]
jobs:
deploy:
uses: Sea-Haven-Industries/.github/.github/workflows/cd-dotnet-eb.yaml@555d07c3a240689a81668026787eba089df4c975 # main
with:
# Required: the project to publish, relative to the repo root.
project: REPLACE-ME-project-csproj
# Required: the Elastic Beanstalk application name.
eb-application: REPLACE-ME-eb-application
# Required: the EXISTING environment to deploy to. This workflow updates
# an environment; it does not create one. Map branches to environments by
# adding one job per branch rather than parameterising by branch.
eb-environment: REPLACE-ME-eb-environment
# The Amazon Linux .NET platform needs a Procfile. Set the entry-point
# command here to have one generated, or delete this line if the repo
# commits its own Procfile into the published output.
procfile-command: REPLACE-ME-dotnet-entry-assembly-dll
secrets:
deploy-role-arn: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}