devnet #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-CD-EKS | |
on: | |
push: | |
branches: | |
- dev/k8s # Executar apenas na branch dev/k8s | |
workflow_dispatch: # Permite disparar o workflow manualmente | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
# Fazer checkout do código | |
- name: Checkout do código | |
uses: actions/checkout@v4 | |
# Fazer login no Docker Hub | |
- name: Docker Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
# Construir e enviar a imagem Docker | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./app | |
file: ./app/Dockerfile | |
push: true | |
tags: | | |
rafallltm/giropops-senhas:latest | |
rafallltm/giropops-senhas:eks-v${{ github.sha }} | |
cd: | |
runs-on: ubuntu-latest | |
needs: ci | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
steps: | |
# Fazer checkout do código | |
- name: Checkout do código | |
uses: actions/checkout@v4 | |
# Autenticar na AWS | |
- name: Autenticar na AWS | |
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: us-east-1 | |
# Atualizar kubeconfig | |
- name: Configurar kubectl | |
run: aws eks update-kubeconfig --name meu-cluster | |
# Validar o Helm Chart | |
- name: Helm Lint | |
run: helm lint ./helm-chat | |
# Instalar app com Helm Chart | |
- name: Deploy with Helm | |
run: | | |
helm upgrade --install giropops ./helm-chat \ | |
--set image.repository=rafallltm/giropops-senhas \ | |
--set image.tag=eks-v${{ github.sha }} \ | |
--atomic \ | |
--timeout 5m |