-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.56 KB
/
build_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI
on:
push:
branches: [ development ]
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: aws-actions/setup-sam@v1
- 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
- uses: actions/setup-java@v1
with:
java-version: 11
- name: Build and Analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cd initial
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain test --domain-owner ${{ secrets.AWS_ACCOUNT_ID }} --query authorizationToken --output text`
bash ./gradlew -Pbuild_target=SNAPSHOT clean build jacocoTestReport spotlessApply spotbugsMain
bash ./gradlew -Pbuild_target=SNAPSHOT sonarqube showSonarQubeLink --info
- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker Build & Push
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
cd initial
export SERVICE_NAME=`echo "${{ github.repository }}" | awk -F "/" '{print $2}'`
export VERSION=`bash ./gradlew -Pbuild_target=SNAPSHOT -q properties | grep version | sed -e "s@version: @@g"`
export SERVICE_CODE=`echo "$VERSION" | cut -d '-' -f1`
export IMAGE_NAME="$ECR_REGISTRY/$SERVICE_NAME:$SERVICE_CODE.${{ github.sha }}"
docker build -t $ECR_REGISTRY/$SERVICE_NAME:$SERVICE_CODE.${{ github.sha }} .
# docker push $ECR_REGISTRY/$SERVICE_NAME:$SERVICE_CODE.${{ github.sha }}
Deploy-To-Dev:
runs-on: ubuntu-latest
needs: Build
concurrency: deploy
environment: dev
steps:
- uses: actions/checkout@v3
- uses: azure/[email protected]
- uses: mikefarah/yq@master
- 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
- name: Clone Common Repo
run: |
eval `ssh-agent -s`
ssh-add - <<< "${{ secrets.SSH_KEY }}"
git clone [email protected]:ksgnextuple/common-deploy-scripts.git
- name: Deploy to EKS
run: ./common-deploy-scripts/scripts/deploy.sh
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
COMMIT_HASH: ${{ github.sha }}
ENVIRONMENT: "dev"