-
Notifications
You must be signed in to change notification settings - Fork 11
49 lines (42 loc) · 1.44 KB
/
manual.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Deploy image to AWS ECR
# Run this workflow every time a new tag is created
on:
create:
tags:
- .*
jobs:
ecr:
# Name the Job
name: build and deploy image to AWS ECR
# Set the type of machine to run on
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Check out code
uses: actions/checkout@v2
- name: Set Tag Number
id: tag-number
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Check Tag Release
env:
RELEASE_VERSION: ${{ steps.tag-number.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REPOSITORY: demo
IMAGE_TAG: ${{ steps.tag-number.outputs.tag }}
run: |
docker build -t demo .
docker tag demo:latest $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG