Skip to content

Commit

Permalink
Adding CD to geth (ethereum#11)
Browse files Browse the repository at this point in the history
* Adding CD to geth
  • Loading branch information
willmeister authored Aug 6, 2020
1 parent 63377e3 commit fa42b78
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/stop-ecs-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [ "$#" -ne 2 ]; then
echo "Invalid number of arguments. Usage: stop-ecs-task.sh <cluster> <service>"
exit 1
fi

cluster=$1
service=$2

tasks=$(aws ecs list-tasks --cluster $cluster --service-name $service)

task_arn=$(echo $tasks | awk -F\[ '{print $2}' | awk -F\" '{print $2}')

if [ -n "${task_arn}" ]; then
aws ecs stop-task --cluster $cluster --task $task_arn > /dev/null
fi
50 changes: 50 additions & 0 deletions .github/workflows/dev-ecr-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build & Tag Container, Push to ECR, Deploy to Dev

on:
push:
branches:
- master

jobs:
build:
name: Build, Tag & push to ECR, Deploy task
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup golang
uses: actions/setup-go@v2
with:
go-version: '1.14.2'

- name: Install & Build
run: make all

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: optimism/geth
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# TODO: Add this when the DEV env is set up
# - name: Stop existing dev-geth ECS task to auto-start task with new image
# run: |
# ./.github/scripts/stop-ecs-task.sh dev-geth geth

- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}

0 comments on commit fa42b78

Please sign in to comment.