Skip to content

Commit 8567284

Browse files
authored
Merge pull request #7 from pangolin-do-golang/cicd
chore: adiciona deploy na actions
2 parents 01766a2 + 2eefd28 commit 8567284

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/BuildApp.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
pull_request:
99
types: [opened, synchronize, reopened]
1010

11-
1211
jobs:
1312
Package:
1413
name: Build Test And Push Image
@@ -18,6 +17,15 @@ jobs:
1817
- name: Checkout
1918
uses: actions/checkout@v4
2019

20+
- name: Configure AWS Credentials 2
21+
uses: aws-actions/configure-aws-credentials@v4
22+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
23+
with:
24+
aws-region: us-east-1
25+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
26+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
role-to-assume: arn:aws:iam::637423374452:role/Terrafor-iac
28+
2129
- uses: benjlevesque/[email protected]
2230
id: short-sha
2331
with:
@@ -46,7 +54,6 @@ jobs:
4654
-Dsonar.language=go
4755
-Dsonar.qualitygate.wait=true
4856
49-
5057
- name: Login to GitHub Container Registry
5158
uses: docker/login-action@v3
5259
with:
@@ -81,3 +88,13 @@ jobs:
8188
REGISTRY: ghcr.io
8289
REPOSITORY: ${{ github.repository }}
8390
IMAGE_TAG: ${{ steps.short-sha.outputs.sha }}
91+
92+
- name: Login to AWS
93+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
94+
shell: bash
95+
run: aws eks update-kubeconfig --region us-east-1 --name development
96+
97+
- uses: actions-hub/kubectl@master
98+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
99+
with:
100+
args: set image deployment/tech-challenge tech-challenge-container=ghcr.io/${{ github.repository }}:${{ steps.short-sha.outputs.sha }}

0 commit comments

Comments
 (0)