Skip to content

Commit

Permalink
Create manual.yml for Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
mukulmantosh committed Mar 19, 2021
1 parent 9fc8445 commit 63b9fe9
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 63b9fe9

Please sign in to comment.