Skip to content

Test deployment

Test deployment #36

name: Build and Push SSV Docker Image to AWS ECR
on:
push:
branches:
- testing-argo-ci-cd # specify the branch you want to trigger the workflow on
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
node-version: 20
- name: Set up AWS CLI
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID_ECR }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY_ECR }}
aws configure set default.region ${{ secrets.AWS_REGION }}
- name: Login to AWS ECR
id: login-ecr
run: |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
- name: Build Docker Image
env:
IMAGE_TAG: ${{ github.sha }}
run: |
echo "GitHub Workflow SHA: $IMAGE_TAG"
docker build -t ssv-node-test:${IMAGE_TAG} .
docker images
printenv
- name: Tag Docker Image
env:
IMAGE_TAG: ${{ github.sha }}
run: |
docker tag ssv-node-test:${IMAGE_TAG} ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/ssv-node-test:${IMAGE_TAG}
- name: Push Docker Image to ECR
env:
IMAGE_TAG: ${{ github.sha }}
run: |
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/ssv-node-test:${IMAGE_TAG}