Skip to content

Instantly share code, notes, and snippets.

View wenqiglantz's full-sized avatar

Wenqi Glantz wenqiglantz

View GitHub Profile
name: Deploy to ECS Fargate and track deployment in DynamoDB
on:
workflow_call:
inputs:
# pass in environment through manual trigger, if not passed in, default to 'dev'
env:
required: true
type: string
default: 'dev'
name: Build and test workflow
on:
workflow_call:
inputs:
# pass in environment through manual trigger, if not passed in, default to 'dev'
env:
required: true
type: string
default: 'dev'
resource "aws_ecs_task_definition" "app" {
family = local.service_name
network_mode = "awsvpc"
cpu = local.container_definition.0.cpu
memory = local.container_definition.0.memory
requires_compatibilities = ["FARGATE"]
container_definitions = jsonencode(local.container_definition)
execution_role_arn = aws_iam_role.task_execution_role.arn
task_role_arn = aws_iam_role.task_role.arn
provider "github" {
token = var.pipeline_token
owner = "your-github-account"
}
......
resource "github_actions_environment_secret" "s3_bucket_name" {
repository = var.deploy_repo
environment = var.deploy_env
name: "Terraform Deployment"
on:
workflow_call:
inputs:
# working-directory is added to specify "terraform" directory in project source code as that's where the terraform files live.
working-directory:
required: false
type: string
default: './terraform'
provider "aws" {
region = "us-east-1"
}
# for github secrets creation
provider "github" {
token = var.pipeline_token
owner = "your-github-account"
}
# This workflow runs maven release to publish artifact to GitHub Packages
name: Release workflow to run maven release to publish release version to GitHub Packages
on:
workflow_dispatch:
push:
branches:
- release/*
# This CD workflow pulls the docker image from ECR and deploys it to the environment specified by the manual trigger
name: CD workflow for deploying microservice to ECS Fargate
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the workflow against'
type: environment
# This CI workflow can be triggered by PR creation or code push in PR, or manual trigger (after maven release)
name: CI workflow for building, testing microservice, and publishing image to ECR
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the workflow against'
type: environment
name: Release workflow for Spring Boot microservices or shared libraries
on:
workflow_call:
inputs:
# working-directory is added to accommodate monorepo. For multi repo, defaults to '.', current directory
working-directory:
required: false
type: string
default: '.'