Skip to content

Commit 872831f

Browse files
committed
ci: create cd workflow
1 parent 7d38149 commit 872831f

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main, "feat/cd" ]
7+
8+
jobs:
9+
test:
10+
name: Tests
11+
uses: ./.github/workflows/ci.yaml
12+
13+
build-and-push:
14+
name: Build and Push
15+
needs: test
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v3
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v4
24+
with:
25+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
26+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
aws-region: us-east-1
28+
29+
- name: Login to Amazon ECR Public
30+
id: login-ecr-public
31+
uses: aws-actions/amazon-ecr-login@v2
32+
with:
33+
registry-type: public
34+
35+
- name: Build and Push Image
36+
env:
37+
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
38+
REGISTRY_ALIAS: d0w1o5s2
39+
REPOSITORY: ubcea/echo-base
40+
TAG: ${{ github.sha }}
41+
run: |
42+
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$TAG .
43+
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$TAG
44+
45+
deploy:
46+
name: Deploy to EC2
47+
needs: build-and-push
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Stub
52+
run: |
53+
echo "not implemented"
54+
exit 1

0 commit comments

Comments
 (0)