Skip to content

Add github-action

Add github-action #3

Workflow file for this run

name: Deploy
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: Tag for the docker image
required: true
jobs:
deploy:
runs-on: [self-hosted, x64, linux, eks, us, general, prod]
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get SHA
id: get-sha
run: echo "::set-output name=sha::$(git log -1 --format='%H')"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ steps.get-sha.outputs.sha }}
- name: Print Disk Usage
run: |
df -ah
docker buildx du
- name: Setup AWS
uses: ironsource-mobile/github-actions-and-workflows/.github/actions/setup-aws@main
with:
aws_role_arn: arn:aws:iam::032106861074:role/github-runners-devops-team-role
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set Image Tag
run: |
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: istio-adaptive-least-request-controller
run: |
docker build --build-arg version=$IMAGE_TAG \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG