Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -41,19 +41,35 @@ jobs:
KAKAO_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_MAPS_CLIENT_ID: ${{ secrets.NAVER_MAPS_CLIENT_ID }}

KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}

run: |
echo DEV_BASE_URL=\"$DEV_BASE_URL\" >> local.properties
echo PROD_BASE_URL=\"$PROD_BASE_URL\" >> local.properties
echo KAKAO_NATIVE_APP_KEY=$KAKAO_NATIVE_APP_KEY >> local.properties
echo NAVER_MAPS_CLIENT_ID=$NAVER_MAPS_CLIENT_ID >> local.properties


echo KEY_ALIAS=$KEY_ALIAS >> local.properties
echo KEY_PASSWORD=$KEY_PASSWORD >> local.properties
echo KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD >> local.properties
echo KEYSTORE_FILE=eatssu.keystore >> local.properties

- name: Generate google-services.json
run: |
echo "$GOOGLE_SERVICE" > app/google-services.json.b64
base64 -d -i app/google-services.json.b64 > app/google-services.json
env:
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}

- name: Generate eatssu.keystore
env:
KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }}
run: |
echo "$KEYSTORE_CONTENT" > app/eatssu.keystore.b64
base64 -d -i app/eatssu.keystore.b64 > app/eatssu.keystore

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
187 changes: 112 additions & 75 deletions .github/workflows/qa_apk.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,125 @@
name: Android APK Build and Slack Upload

on:
workflow_dispatch: # 버튼을 누를 시 실행되도록 설정
workflow_dispatch: # 버튼을 누를 시 실행되도록 설정
inputs:
environment:
description: 'Select environment'
buildVariant:
description: 'Build Variant'
required: true
default: 'qa'
default: 'debug'
type: choice
options:
- qa
- production
- debug
- release
branch:
description: '빌드할 브랜치'
required: true
default: 'develop'
type: string

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Create Local Properties
run: touch local.properties

- name: Access Local Properties
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
KAKAO_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
run: |
echo DEV_BASE_URL=\"$DEV_BASE_URL\" >> local.properties
echo PROD_BASE_URL=\"$PROD_BASE_URL\" >> local.properties
echo KAKAO_NATIVE_APP_KEY=$KAKAO_APP_KEY >> local.properties

- name: Generate google-services.json
run: |
echo "$GOOGLE_SERVICE" > app/google-services.json.b64
base64 -d -i app/google-services.json.b64 > app/google-services.json
env:
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Debug APK
run: ./gradlew assembleDebug --stacktrace

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app
path: app/build/outputs/apk/debug/app-debug.apk

- name: Slack - Send Msg
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,commit,repo,author,job,ref,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Slack - Upload APK
if: github.event_name == 'workflow_dispatch'
uses: MeilCli/slack-upload-file@v4
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
initial_comment: 'APK 빌드가 완료되었습니다.'
file_type: 'apk'
file_name: 'app-debug.apk'
file_path: './app/build/outputs/apk/debug/app-debug.apk'
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Create Local Properties
run: touch local.properties

- name: Access Local Properties
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
KAKAO_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
NAVER_MAPS_CLIENT_ID: ${{ secrets.NAVER_MAPS_CLIENT_ID }}

KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}

run: |
echo DEV_BASE_URL=\"$DEV_BASE_URL\" >> local.properties
echo PROD_BASE_URL=\"$PROD_BASE_URL\" >> local.properties
echo KAKAO_NATIVE_APP_KEY=$KAKAO_NATIVE_APP_KEY >> local.properties
echo NAVER_MAPS_CLIENT_ID=$NAVER_MAPS_CLIENT_ID >> local.properties

echo KEY_ALIAS=$KEY_ALIAS >> local.properties
echo KEY_PASSWORD=$KEY_PASSWORD >> local.properties
echo KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD >> local.properties
echo KEYSTORE_FILE=eatssu.keystore >> local.properties

- name: Generate google-services.json
run: |
echo "$GOOGLE_SERVICE" > app/google-services.json.b64
base64 -d -i app/google-services.json.b64 > app/google-services.json
env:
GOOGLE_SERVICE: ${{ secrets.GOOGLE_SERVICE }}

- name: Generate eatssu.keystore
env:
KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }}
run: |
echo "$KEYSTORE_CONTENT" > app/eatssu.keystore.b64
base64 -d -i app/eatssu.keystore.b64 > app/eatssu.keystore

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set Distribution Target
id: set-target
run: |
if [[ "${{ github.event.inputs.buildVariant }}" == "debug" ]]; then
echo "VARIANT=Debug" >> $GITHUB_ENV
else
echo "VARIANT=Release" >> $GITHUB_ENV
fi

- name: Build APK
run: ./gradlew assemble${{ env.VARIANT }}

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app
path: app/build/outputs/apk/${{ github.event.inputs.buildVariant }}/app-${{ github.event.inputs.buildVariant }}.apk

- name: Slack - Send Msg
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,commit,repo,author,job,ref,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Slack - Upload APK
if: github.event_name == 'workflow_dispatch'
uses: MeilCli/slack-upload-file@v4
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
initial_comment: '${{ github.event.inputs.branch }} 브랜치의 ${{ github.event.inputs.buildVariant }} Variant APK 빌드가 완료되었습니다.'
file_type: 'apk'
file_name: 'app-${{ github.event.inputs.buildVariant }}.apk'
file_path: './app/build/outputs/apk/${{ github.event.inputs.buildVariant }}/app-${{ github.event.inputs.buildVariant }}.apk'
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ captures/

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks
*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
Expand Down
14 changes: 14 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ android {
compose = true
}

signingConfigs {
val p = Properties()
p.load(project.rootProject.file("local.properties").reader())

create("release") {
keyAlias = p.getProperty("KEY_ALIAS")
keyPassword = p.getProperty("KEY_PASSWORD")
storeFile = file(p.getProperty("KEYSTORE_FILE"))
storePassword = p.getProperty("KEYSTORE_PASSWORD")
}
}

buildTypes {
release {
val p = Properties()
Expand All @@ -55,6 +67,8 @@ android {
isShrinkResources = false
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")

signingConfig = signingConfigs["release"]
}

debug {
Expand Down