!!Deploy: Using Cloudformation #326
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "!!Deploy: Using Cloudformation" | |
on: | |
workflow_dispatch: | |
# note MAX inputs = 10 | |
inputs: | |
CLOUD_FORMATION_STACK: | |
description: '1. The Cloud Formation stack to deploy as' | |
required: true | |
CLOUD_FORMATION_TEMPLATE_FILE: | |
description: '2. The Cloud Formation file to deploy' | |
required: true | |
DOCKER_APP_OWNER: | |
description: '3. docker app owner' | |
required: true | |
DOCKER_APP_NAME: | |
description: '4. docker app name' | |
required: true | |
API_HOST: | |
description: '5. Api Host' | |
required: false | |
API_PREFIX: | |
description: '6. API Prefix' | |
required: false | |
AWS_LOAD_BALANCER_HOSTNAME: | |
description: "7. AWS Load Balancer match hostname" | |
required: false | |
AWS_LOAD_BALANCER_PRIORITY: | |
description: "8. AWS Load Balancer match priority" | |
required: true | |
AWS_CONTAINER_REGISTRY: | |
description: "9. AWS container registry to retrieve package from" | |
required: true | |
BUILD_VERSION: | |
description: "10. Build Version" | |
required: true | |
# Don't cancel anything in progress | |
concurrency: | |
group: ${{github.workflow}}-${{inputs.CLOUD_FORMATION_STACK}}-${{inputs.BUILD_VERSION}} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
security-events: write | |
jobs: | |
deploy: | |
runs-on: [self-hosted, linux, deploy] | |
steps: | |
- name: "Correct ownership" | |
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE" | |
- name: "Checkout" | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: "Log parameters" | |
shell: bash | |
run: | | |
echo "CLOUD_FORMATION_STACK: ${{inputs.CLOUD_FORMATION_STACK}}" | |
echo "CLOUD_FORMATION_TEMPLATE_FILE: ${{inputs.CLOUD_FORMATION_TEMPLATE_FILE}}" | |
echo "DOCKER_APP_OWNER: ${{inputs.DOCKER_APP_OWNER}}" | |
echo "DOCKER_APP_NAME: ${{inputs.DOCKER_APP_NAME}}" | |
echo "BUILD_VERSION: ${{inputs.BUILD_VERSION}}" | |
echo "API_HOST: ${{inputs.API_HOST}}" | |
echo "API_PREFIX: ${{inputs.API_PREFIX}}" | |
echo "AWS_LOAD_BALANCER_HOSTNAME: ${{inputs.AWS_LOAD_BALANCER_HOSTNAME}}" | |
echo "AWS_CONTAINER_REGISTRY: ${{inputs.AWS_CONTAINER_REGISTRY}}" | |
echo "AWS_LOAD_BALANCER_PRIORITY: ${{inputs.AWS_LOAD_BALANCER_PRIORITY}}" | |
- name: "Configure AWS Credentials" | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_ACCESS_KEY_ID}} | |
aws-secret-access-key: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_SECRET_ACCESS_KEY}} | |
aws-region: ${{vars.AWS_REGION}} | |
- name: "Cloudformation Deploy" | |
uses: ./.github/actions/cloudformation-deploy | |
with: | |
CLOUD_FORMATION_STACK: ${{inputs.CLOUD_FORMATION_STACK}} | |
CLOUDFORMATION_SNS_ARN: ${{vars.CLOUDFORMATION_SNS_ARN}} | |
CLOUD_FORMATION_TEMPLATE_FILE: "${{github.workspace}}/${{inputs.CLOUD_FORMATION_TEMPLATE_FILE}}" | |
DOCKER_APP_OWNER: ${{inputs.DOCKER_APP_OWNER}} | |
DOCKER_APP_NAME: ${{inputs.DOCKER_APP_NAME}} | |
BUILD_VERSION: ${{inputs.BUILD_VERSION}} | |
API_HOST: ${{inputs.API_HOST}} | |
API_PREFIX: ${{inputs.API_PREFIX}} | |
AWS_LOAD_BALANCER_HOSTNAME: ${{inputs.AWS_LOAD_BALANCER_HOSTNAME}} | |
AWS_LOAD_BALANCER_PRIORITY: ${{inputs.AWS_LOAD_BALANCER_PRIORITY}} | |
AWS_CONTAINER_REGISTRY: ${{inputs.AWS_CONTAINER_REGISTRY}} | |
- name: "Log Build Version" | |
uses: actions/[email protected] | |
with: | |
script: | | |
core.info('Application: \u001b[38;5;6m${{inputs.DOCKER_APP_OWNER}}\\${{inputs.DOCKER_APP_NAME}}'); | |
core.info('Version: \u001b[38;5;6m${{inputs.BUILD_VERSION}}'); | |
core.info('Stack: \u001b[38;5;6m${{inputs.CLOUD_FORMATION_STACK}}'); | |
core.notice('Application: ${{inputs.DOCKER_APP_OWNER}}\\${{inputs.DOCKER_APP_NAME}}'); | |
core.notice('Version: ${{inputs.BUILD_VERSION}}'); | |
core.notice('Stack: ${{inputs.CLOUD_FORMATION_STACK}}'); |