Skip to content

Commit

Permalink
add basic github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dschofie committed Nov 2, 2023
0 parents commit f3d01fa
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
telophase
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.21
LABEL maintainer="Danny Schofield, [email protected]"

# copy from repo into container image:
COPY entrypoint.sh /entrypoint.sh
COPY telophasecli /telophase

# make default on start-up:
ENTRYPOINT ["/entrypoint.sh"]

47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Telophase CLI Github Action
This action allows for you to manage your AWS accounts and organization with telophase.


## Example Usage
In a GH Action file, for example, `.github/workflows/main.yaml`:

```
on: [push]
jobs:
create_cluster:
runs-on: ubuntu-latest
name: Manage AWS accounts and organization with telophase
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
# Use the credentials for the Management Account
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Plan
uses: telophase-actions/[email protected]
with:
apply: false
- name: Provision cluster
uses: telophase-actions/[email protected]
with:
# Setting apply to true means that the GitHub action will modify your infrastructure.
apply: true
```

# Inputs
- apply: 'If the infrastructure change should be applied'
- cdk_path: 'If the infrastructure change should be applied'
- account_tag: 'Tag associated with the accounts to deploy'
- organization_path: 'Path to your organization.yml file'
- stacks: 'Stacks to deploy if not set will deploy all stacks'

# Env
- `AWS_ACCESS_KEY_ID` Required
- `AWS_SECRET_ACCESS_KEY` Required

## License
This project is licensed under the Apache-2.0 License.
33 changes: 33 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Telophase CLI deploy'
description: 'Update your infrastructure with the Telophase CLI'
inputs:
apply:
description: 'If the infrastructure change should be applied'
required: true
default: false

cdk_path:
description: 'If the infrastructure change should be applied'
required: false

account_tag:
description: 'Tag associated with the accounts to deploy'
required: false
default: "all"

organization_path:
description: 'Path to your organization.yml file'
required: false

stacks:
description: 'Stacks to deploy'
required: false
default: ""

runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.apply }}
- ${{ inputs.cdk-path }}
- ${{ inputs.account-tag }}
28 changes: 28 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#/bin/sh

set -e

# go install github.com/santiago-labs/telophasecli@latest
apply=""
if [ $INPUT_APPLY = true ]; then
apply="--appply"
fi

cdk_path=""
if [ $INPUT_CDK_PATH ]; then
cdk_path="--cdk-path=$INPUT_CDK_PATH"
fi

account_tag="--account-tag=$INPUT_ACCOUNT_TAG"

org_file=""
if [ $INPUT_ORGANIZATION_PATH ]; then
org_file="--org=$INPUT_ORGANIZATION_PATH"
fi

stacks="--all-stacks"
if [ $INPUT_STACKS ]; then
stacks="--stacks=-\"$INPUT_STACKS\""
fi

./telophase deploy $apply $cdk_path $account_tag $org_file $stacks

0 comments on commit f3d01fa

Please sign in to comment.