Skip to content

Commit 58ba492

Browse files
committed
💊 github-ci push to aws ECR
1 parent 7910404 commit 58ba492

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy to production
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
7+
jobs:
8+
build:
9+
name: Build image
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v3
15+
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@v1
18+
with:
19+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21+
aws-region: ap-southeast-1
22+
23+
- name: Login to Amazon ECR
24+
id: login-ecr
25+
uses: aws-actions/amazon-ecr-login@v1
26+
27+
- name: Build, tag, and push image to Amazon ECR
28+
env:
29+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
30+
ECR_REPOSITORY: tinybank
31+
IMAGE_TAG: ${{ github.sha }}
32+
run: |
33+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
34+
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will build a golang project
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
33

4-
name: ci-test
4+
name: Run unit tests
55

66
on:
77
push:

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"docwriter.style": "Auto-detect"
2+
"docwriter.style": "Auto-detect",
3+
"yaml.schemas": {
4+
"https://json.schemastore.org/github-workflow.json": "file:///home/mars/Minh%27sLand/tinybank/.github/workflows/deploy.yml"
5+
}
36
}

0 commit comments

Comments
 (0)