|
1 |
| -name: Java CI with Gradle |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | pull_request:
|
5 | 5 | branches: [ "develop" ]
|
6 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
7 | 10 | jobs:
|
8 | 11 | ci:
|
9 | 12 | runs-on: ubuntu-latest
|
10 | 13 | steps:
|
11 |
| - - name: Checkout |
12 |
| - uses: actions/checkout@v3 |
| 14 | + - uses: actions/checkout@v3 |
13 | 15 | - name: Set up JDK 17
|
14 | 16 | uses: actions/setup-java@v3
|
15 | 17 | with:
|
16 |
| - |
17 | 18 | java-version: '17'
|
18 | 19 | distribution: 'temurin'
|
19 |
| - |
20 |
| - - name: 1) Convert to prod config |
21 |
| - run: | |
22 |
| - cd ./api/src/main/resources |
23 |
| - [ -e "application.yml" ] && rm application.yml |
24 |
| - echo "spring:" > application.yml |
25 |
| - echo " profiles:" >> application.yml |
26 |
| - echo " group:" >> application.yml |
27 |
| - echo " "prod": "db, s3, redis, email, portone, firebase, security"" >> application.yml |
28 |
| - echo " default: prod" >> application.yml |
29 |
| - |
30 |
| - echo " servlet:" >> application.yml |
31 |
| - echo " multipart:" >> application.yml |
32 |
| - echo " max-file-size: 20MB" >> application.yml |
33 |
| - echo " max-request-size: 20MB" >> application.yml |
34 |
| -
|
35 |
| -
|
36 |
| - - name: 2) Set FCM |
37 |
| - env: |
38 |
| - DATA: ${{ secrets.FIREBASE_KEY }} |
39 |
| - run: | |
40 |
| - mkdir -p ./core/core-infra-firebase/src/main/resources/firebase |
41 |
| - echo $DATA > ./core/core-infra-firebase/src/main/resources/firebase/firebase-key.json |
42 |
| -
|
43 |
| - - name: 3) application-security.yml |
44 |
| - uses: microsoft/variable-substitution@v1 |
45 |
| - with: |
46 |
| - files: ./core/core-infra-security/src/main/resources/application-security.yml |
47 |
| - env: |
48 |
| - spring.jwt.secret: ${{ secrets.JWT_SECRET }} |
49 |
| - spring.jwt.token.access-expiration-time: ${{ secrets.JWT_ACCESS_EXPIRATION_TIME }} |
50 |
| - spring.jwt.token.refresh-expiration-time: ${{ secrets.JWT_REFRESH_EXPIRATION_TIME }} |
51 |
| - |
52 |
| - - name: 4) Set application-db.yml |
53 |
| - uses: microsoft/variable-substitution@v1 |
54 |
| - with: |
55 |
| - files: ./core/core-infra-db/src/main/resources/application-db.yml |
56 |
| - env: |
57 |
| - spring.datasource.url: ${{ secrets.DB_URL }} |
58 |
| - spring.datasource.username: ${{ secrets.DB_USERNAME }} |
59 |
| - spring.datasource.password: ${{ secrets.DB_PW }} |
60 |
| - |
61 |
| - - name: 5) Set application-s3.yml |
62 |
| - uses: microsoft/variable-substitution@v1 |
63 |
| - with: |
64 |
| - files: ./core/core-infra-s3/src/main/resources/application-s3.yml |
65 |
| - env: |
66 |
| - cloud.aws.s3.bucket: ${{ secrets.BUCKET }} |
67 |
| - cloud.aws.region.static: ${{ secrets.REGION }} |
68 |
| - cloud.aws.credentials.accessKey: ${{ secrets.S3_ACCESS_KEY }} |
69 |
| - cloud.aws.credentials.secretKey: ${{ secrets.S3_SECRET_KEY }} |
70 |
| - |
71 |
| - - name: 6) Set application-redis.yml |
72 |
| - uses: microsoft/variable-substitution@v1 |
73 |
| - with: |
74 |
| - files: ./core/core-infra-redis/src/main/resources/application-redis.yml |
75 |
| - env: |
76 |
| - spring.data.redis.host: ${{ secrets.REDIS_HOST }} |
77 |
| - spring.data.redis.port: ${{ secrets.REDIS_PORT }} |
78 |
| - |
79 |
| - - name: 7) Set application-email.yml |
80 |
| - uses: microsoft/variable-substitution@v1 |
81 |
| - with: |
82 |
| - files: ./core/core-infra-email/src/main/resources/application-email.yml |
83 |
| - env: |
84 |
| - mail.smtp.port: ${{ secrets.EMAIL_PORT }} |
85 |
| - AdminMail.id: ${{ secrets.EMAIL_ID }} |
86 |
| - AdminMail.password: ${{ secrets.EMAIL_PASSWORD }} |
87 |
| - |
88 |
| - - name: 8) Set application-portone.yml |
89 |
| - uses: microsoft/variable-substitution@v1 |
90 |
| - with: |
91 |
| - files: ./core/core-infra-portone/src/main/resources/application-portone.yml |
92 |
| - env: |
93 |
| - PORT_ONE_KEY: ${{ secrets.PORT_ONE_KEY}} |
94 |
| - PORT_ONE_SECRET: ${{ secrets.PORT_ONE_SECRET}} |
95 |
| - |
96 |
| - - name: 9) Set application-firebase.yml |
97 |
| - uses: microsoft/variable-substitution@v1 |
98 |
| - with: |
99 |
| - files: ./core/core-infra-firebase/src/main/resources/application-firebase.yml |
100 |
| - env: |
101 |
| - firebase.fcmUrl: ${{ secrets.FIREBASE_URL}} |
102 |
| - firebase.firebaseConfigPath: ${{ secrets.FIREBASE_PATH}} |
103 |
| - |
104 |
| - - name: Grant execute permission for gradlew and build |
105 |
| - run: | |
106 |
| - chmod +x ./gradlew |
107 |
| - ./gradlew clean |
108 |
| - ./gradlew build -x test |
109 |
| -
|
110 |
| - # Docker image Build (1) |
111 |
| - - name: Docker image build |
112 |
| - run: docker build -t ${{ secrets.DOCKER_USERNAME }}/sponus-docker --pull --no-cache --platform linux/amd64 . |
113 |
| - |
114 |
| - # DockerHub Login (2) |
115 |
| - - name: Docker login |
116 |
| - uses: docker/login-action@v2 |
117 |
| - with: |
118 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
119 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
120 |
| - |
121 |
| - # Docker Hub push (3) |
122 |
| - - name: Docker Hub push |
123 |
| - run: docker push ${{ secrets.DOCKER_USERNAME }}/sponus-docker |
| 20 | + - name: Grant execute permission for gradlew |
| 21 | + run: chmod +x gradlew |
| 22 | + - name: Test with Gradle |
| 23 | + run: ./gradlew test |
0 commit comments