Skip to content

Commit

Permalink
feat: Add FIREBASE_CONFIG_PATH to github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
okodeee committed Jun 10, 2024
1 parent edd4f1f commit ff93762
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ jobs:
- name: Create Firebase Admin SDK JSON file
env:
FIREBASE_ADMIN_SDK: ${{ secrets.FIREBASE_ADMIN_SDK }}
FIREBASE_CONFIG_PATH: /firebase/vomvom-fd09b-firebase-adminsdk-ghtjs-0070b39a4e.json
run: |
mkdir -p /firebase
echo "$FIREBASE_ADMIN_SDK" > /firebase/vomvom-fd09b-firebase-adminsdk-ghtjs-0070b39a4e.json
# 3) gradlew 권한 설정
- name: Grant execute permission for gradlew
Expand All @@ -67,6 +69,8 @@ jobs:
# 4) test 제외 gradle 빌드
- name: Build with Gradle
run: ./gradlew clean build -x test
env:
FIREBASE_CONFIG_PATH: /firebase/vomvom-fd09b-firebase-adminsdk-ghtjs-0070b39a4e.json
# working-directory: ${{ env.working-directory }}
# 5) AWS 인증
- name: Configure AWS credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public int sendMessageTo(Long memberId) throws IOException {
*/
private String getAccessToken() throws IOException {

String firebaseConfigPath = "firebase/vomvom-fd09b-firebase-adminsdk-ghtjs-0070b39a4e.json";
String firebaseConfigPath = System.getenv("FIREBASE_CONFIG_PATH");
if (firebaseConfigPath == null) {
firebaseConfigPath = "firebase/vomvom-fd09b-firebase-adminsdk-ghtjs-0070b39a4e.json";
}

GoogleCredentials googleCredentials = GoogleCredentials
.fromStream(new ClassPathResource(firebaseConfigPath).getInputStream())
Expand Down

0 comments on commit ff93762

Please sign in to comment.