Skip to main content

.NET - GitHub Actions Pipeline

The pipeline will automate provisioning and updating the .NET REST API with CQRS infrastructure in AWS.

Pipeline Diagram

Feature branch -> Dev sequence

Dev .NET REST API - GitHub Actions Pipeline

Main branch -> Production sequence

Prod .NET REST API - GitHub Actions Pipeline

Setting up GitHub Actions

Variables

A variable file located at .github/workflows/ci-env.yml will contain the majority of the variables required for the pipeline. This file should be manually checked and updated where required before first deployment. If the project was generated using the Stacks CLI then the file will be updated with the information provided.

Environment secrets will need creating for storing some sensitive variables to be used by the pipeline. Instructions for creating a environment secrets can be found here.

Add the following secrets:

Variable NameDescriptionRequired for
AWS_ACCESS_KEY_IDAWS IAM User Access Key IDAWS Authentication
AWS_ACCOUNT_IDAWS Account IDAWS Authentication
AWS_SECRET_ACCESS_KEYAWS IAM User Secret Access KeyAWS Authentication
AWS_TF_STATE_BUCKETS3 Bucket name for Terraform stateTerraform State Management
AWS_TF_STATE_DYNAMOTABLEDynamoDB Table name for Terraform stateTerraform State Management
AWS_TF_STATE_ENCRYPTIONEncrypt Terraform state. true or falseTerraform State Management
AWS_TF_STATE_KEYUnique name for this applications Terraform stateTerraform State Management
AWS_TF_STATE_REGIONAWS regionTerraform State Management

Creating the pipeline

Stacks generates the GitHub Actions workflow file in the directory expected by GitHub Actions, .github/workflows. Committing this file to the main branch of a GitHub repository will "create" the pipeline. Instructions for viewing the results can be found here