From 2eefd280b6283ad85372103735685ea0589a1a1e Mon Sep 17 00:00:00 2001 From: Jeferson Date: Tue, 3 Dec 2024 21:51:41 -0300 Subject: [PATCH] chore: adiciona deploy na actions --- .github/workflows/BuildApp.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/BuildApp.yaml b/.github/workflows/BuildApp.yaml index b013e67..d069d45 100644 --- a/.github/workflows/BuildApp.yaml +++ b/.github/workflows/BuildApp.yaml @@ -8,7 +8,6 @@ on: pull_request: types: [opened, synchronize, reopened] - jobs: Package: name: Build Test And Push Image @@ -18,6 +17,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Configure AWS Credentials 2 + uses: aws-actions/configure-aws-credentials@v4 + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + with: + aws-region: us-east-1 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-to-assume: arn:aws:iam::637423374452:role/Terrafor-iac + - uses: benjlevesque/short-sha@v3.0 id: short-sha with: @@ -46,7 +54,6 @@ jobs: -Dsonar.language=go -Dsonar.qualitygate.wait=true - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -81,3 +88,13 @@ jobs: REGISTRY: ghcr.io REPOSITORY: ${{ github.repository }} IMAGE_TAG: ${{ steps.short-sha.outputs.sha }} + + - name: Login to AWS + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + shell: bash + run: aws eks update-kubeconfig --region us-east-1 --name development + + - uses: actions-hub/kubectl@master + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + with: + args: set image deployment/tech-challenge tech-challenge-container=ghcr.io/${{ github.repository }}:${{ steps.short-sha.outputs.sha }}