Skip to content

Commit fa42b78

Browse files
authored
Adding CD to geth (#11)
* Adding CD to geth
1 parent 63377e3 commit fa42b78

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

.github/scripts/stop-ecs-task.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -ne 2 ]; then
4+
echo "Invalid number of arguments. Usage: stop-ecs-task.sh <cluster> <service>"
5+
exit 1
6+
fi
7+
8+
cluster=$1
9+
service=$2
10+
11+
tasks=$(aws ecs list-tasks --cluster $cluster --service-name $service)
12+
13+
task_arn=$(echo $tasks | awk -F\[ '{print $2}' | awk -F\" '{print $2}')
14+
15+
if [ -n "${task_arn}" ]; then
16+
aws ecs stop-task --cluster $cluster --task $task_arn > /dev/null
17+
fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build & Tag Container, Push to ECR, Deploy to Dev
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
name: Build, Tag & push to ECR, Deploy task
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup golang
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: '1.14.2'
19+
20+
- name: Install & Build
21+
run: make all
22+
23+
- name: Configure AWS Credentials
24+
uses: aws-actions/configure-aws-credentials@v1
25+
with:
26+
aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
27+
aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
28+
aws-region: us-east-2
29+
30+
- name: Login to Amazon ECR
31+
id: login-ecr
32+
uses: aws-actions/amazon-ecr-login@v1
33+
34+
- name: Build, tag, and push image to Amazon ECR
35+
env:
36+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
37+
ECR_REPOSITORY: optimism/geth
38+
IMAGE_TAG: latest
39+
run: |
40+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
41+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
42+
43+
# TODO: Add this when the DEV env is set up
44+
# - name: Stop existing dev-geth ECS task to auto-start task with new image
45+
# run: |
46+
# ./.github/scripts/stop-ecs-task.sh dev-geth geth
47+
48+
- name: Logout of Amazon ECR
49+
if: always()
50+
run: docker logout ${{ steps.login-ecr.outputs.registry }}

0 commit comments

Comments
 (0)