-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (80 loc) · 2.63 KB
/
core-service.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Java CI with Gradle
on:
pull_request:
branches: [ "Taein2-patch-1" ]
env:
ecr_url: ${{ secrets.ECR_REPO_DEV }}
role_arn: ${{ secrets.OIDC_ROLE }}
aws_region: ${{ secrets.AWS_REGION }}
git_token: ${{ secrets.GIT_TOKEN }}
git_url: "github.com/Project-Catcher/core-service-kusto.git"
git_user: ${{ secrets.GIT_USER }}
git_email: ${{ secrets.GIT_EMAIL }}
permissions:
id-token: write
contents: read
jobs:
build:
name: Build
# runs-on: self-hosted
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew bootJar
- name: Docker build
run: docker build -t core-service .
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.aws_region }}
role-session-name: GitHubActions
role-to-assume: ${{ env.role_arn }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Publish Image to ECR(CORE-SERVICE)
run: |
# docker tag core-service:latest ${{ env.ecr_url }}:core-service
# docker push ${{ env.ecr_url }}:core-service
docker tag core-service:latest ${{ env.ecr_url }}:${{ github.sha }}
docker push ${{ env.ecr_url }}:${{ github.sha }}
- name: Set up Git
run: |
git config --global user.email ${{ env.git_email }}
git config --global user.name ${{ env.git_user }}
git config --global pull.rebase true
pwd
cd ./kustomize/overlays/dev/
pwd
git init
git pull https://${{ env.git_user }}:${{ env.git_token }}@${{ env.git_url }}
- name: Edit kustomize file
run: |
pwd
ls -al
tree
cd ./kustomize/overlays/dev/
kustomize edit set image catcher-core-image=${{ env.ecr_url }}:${{ github.sha }}
kustomize build .
cat kustomization.yaml
- name: Commit and Push files
run: |
cd ../..
git add .
git commit -m "test commit from runner"
git push origin dev