Skip to content

zubi zubi

zubi zubi #73

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Deploy to production
on:
push:
branches: [ "master" ]
jobs:
deploy:
name: Build image
permissions:
id-token: write # need this for OIDC
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.27.1'
id: install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::789980025226:role/sm-actions-role
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Load secrets and save to app.env
run: aws secretsmanager get-secret-value --secret-id simple_bank --query SecretString --output text | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' > app.env
# - name: Build, tag, and push docker image to Amazon ECR
# env:
# REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# REPOSITORY: simplebank
# IMAGE_TAG: ${{ github.sha }}
# run: |
# docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -t $REGISTRY/$REPOSITORY:latest .
# docker push -a $REGISTRY/$REPOSITORY
- name: Update kube config
run: aws eks update-kubeconfig --name simple-bank --region eu-west-1 --role-arn arn:aws:iam::789980025226:role/sm-actions-role
- name: Deploy image to Amazon EKS
run: |
aws sts get-caller-identity
kubectl config current-context
# cat /home/runner/.kube/config
kubectl apply -f eks/aws-auth.yaml
# kubectl apply -f eks/deployment.yaml
# kubectl apply -f eks/service.yaml
# kubectl apply -f eks/issuer.yaml
# kubectl apply -f eks/ingress.yaml