stop pipeline #13
This file contains hidden or 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: | |
- main # Vai disparar quando fizer push na main | |
# - 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:2.${{ github.run_number }} | |
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 | |
- name: Create namespace giropops-senhas | |
run: kubectl create namespace giropops-senhas || true | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
run: | | |
helm repo add stable https://charts.helm.sh/stable | |
helm repo update | |
# Deploy no Kubernetes | |
- name: Deploy to Kubernetes | |
uses: Azure/k8s-deploy@v5 | |
with: | |
manifests: | | |
./manifestos/giropops-senhas-deployment.yaml | |
./manifestos/redis-deployment.yaml | |
./manifestos/giropops-senhas-svc.yaml | |
./manifestos/redis-svc.yaml | |
images: | | |
rafallltm/giropops-senhas:2.${{ github.run_number }} | |
namespace: giropops-senhas # Definir explicitamente o namespace correto |