Skip to main content

GitHub Action: deploy-spacelift

Opinionated way to deploy Docker image app with Spacelift

Introduction

Set Docker image uri into SSM parameter store and trigger Spacelift stack that should handle deployment.

Usage

  name: Pull Request
on:
pull_request:
branches: [ 'main' ]
types: [opened, synchronize, reopened, closed, labeled, unlabeled]

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: ${{ steps.deploy.outputs.webapp-url }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-[email protected]
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::123456789012:role/AllowWriteSSM

- name: Deploy
uses: cloudposse/github-action-deploy-spacelift@main
id: deploy
with:
stack: ecs-service-production
region: us-west-2
ssm-path: /ecs-service/image
image: nginx
image-tag: latest
operation: deploy
debug: false
github_token: ${{ secrets.GITHUB_TOKEN }}
organization: acme
api_key_id: ${{ secrets.SPACELIFT_API_KEY_ID }}
api_key_secret: ${{ secrets.SPACELIFT_API_KEY_SECRET }}

outputs:
url: ${{ steps.deploy.outputs.webapp-url }}

Inputs

NameDescriptionDefaultRequired
api_key_idSpacelift API Key IDN/Atrue
api_key_secretSpacelift API Key SecretN/Atrue
debugDebug modefalsefalse
github_tokenGitHub TokenN/Atrue
imageDocker imageN/Atrue
image-tagDocker image tagN/Atrue
namespaceNamespaceN/Afalse
operationOperation (valid options - deploy, destroy)deploytrue
organizationSpacelift organization nameN/Atrue
regionAWS RegionN/Atrue
ssm-pathSSM path for Docker imageN/Afalse
stackSpacelift stack nameN/Atrue
webapp-output-nameSpacelist stack output field contains webapp host namefull_domainfalse

Outputs

NameDescription
webapp-urlWeb Application url