|
| 1 | +name: Wable Release Note |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + shell: bash |
| 10 | + working-directory: . |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + name: Generate Release APK, Note |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: set up JDK 17 |
| 22 | + uses: actions/setup-java@v4 |
| 23 | + with: |
| 24 | + distribution: "zulu" |
| 25 | + java-version: 17 |
| 26 | + |
| 27 | + - name: Setup Android SDK |
| 28 | + uses: android-actions/setup-android@v3 |
| 29 | + |
| 30 | + - name: Add Network Base Url |
| 31 | + env: |
| 32 | + WABLE_DEV_BASE_URL: ${{ secrets.WABLE_DEV_BASE_URL }} |
| 33 | + WABLE_REL_BASE_URL: ${{ secrets.WABLE_REL_BASE_URL }} |
| 34 | + run: | |
| 35 | + echo wable.dev.base.url=$WABLE_DEV_BASE_URL >> ./local.properties |
| 36 | + echo wable.rel.base.url=$WABLE_REL_BASE_URL >> ./local.properties |
| 37 | +
|
| 38 | + - name: Access Google Services JSON (Debug) |
| 39 | + env: |
| 40 | + GOOGLE_SERVICES_JSON_DEV: ${{ secrets.GOOGLE_SERVICES_JSON_DEV }} |
| 41 | + run: echo $GOOGLE_SERVICES_JSON_DEV | base64 -di > ./app/src/debug/google-services.json |
| 42 | + |
| 43 | + - name: Access Google Services JSON (Release) |
| 44 | + env: |
| 45 | + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} |
| 46 | + run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./app/src/release/google-services.json |
| 47 | + |
| 48 | + - name: Verify google-services.json files |
| 49 | + run: | |
| 50 | + ls -l ./app/src/debug/google-services.json |
| 51 | + ls -l ./app/src/release/google-services.json |
| 52 | +
|
| 53 | + - name: Access Keystore |
| 54 | + env: |
| 55 | + DEBUG_KEY_STORE: ${{ secrets.DEBUG_KEY_STORE }} |
| 56 | + RELEASE_JKS: ${{ secrets.RELEASE_JKS }} |
| 57 | + RELEASE_KEY_STORE_PROPERTIES: ${{ secrets.RELEASE_KEY_STORE_PROPERTIES }} |
| 58 | + run: | |
| 59 | + echo $RELEASE_JKS | base64 -di > ./app/keystore/release.jks |
| 60 | + echo $RELEASE_KEY_STORE_PROPERTIES | base64 -di > ./keystore.properties |
| 61 | + echo $DEBUG_KEY_STORE | base64 -di > ./app/keystore/debug.keystore |
| 62 | +
|
| 63 | + - name: Cache Gradle packages |
| 64 | + uses: actions/cache@v4 |
| 65 | + with: |
| 66 | + path: | |
| 67 | + ~/.gradle/caches |
| 68 | + ~/.gradle/wrapper |
| 69 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} |
| 70 | + restore-keys: | |
| 71 | + ${{ runner.os }}-gradle- |
| 72 | +
|
| 73 | + - name: Grant execute permission for gradlew |
| 74 | + run: chmod +x gradlew |
| 75 | + |
| 76 | + - name: Extract Version Name |
| 77 | + run: | |
| 78 | + VERSION=$(grep -oP 'appVersion\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' gradle/libs.versions.toml) |
| 79 | + echo "##[set-output name=version;]v$VERSION" |
| 80 | + id: extract_version |
| 81 | + |
| 82 | + - name: Build release APK |
| 83 | + run: ./gradlew assembleRelease --stacktrace |
| 84 | + |
| 85 | + - name: Upload Release Build to APK |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: release-apk |
| 89 | + path: app/build/outputs/apk/release/ |
| 90 | + if-no-files-found: error |
| 91 | + |
| 92 | + - name: Create Github Release note |
| 93 | + uses: softprops/action-gh-release@v1 |
| 94 | + with: |
| 95 | + tag_name: ${{ steps.extract_version.outputs.version }} |
| 96 | + release_name: ${{ steps.extract_version.outputs.version }} |
| 97 | + generate_release_notes: true |
| 98 | + files: | |
| 99 | + app/build/outputs/apk/release/app-release.apk` |
| 100 | +
|
| 101 | + - name: On Success, Notify in Slack |
| 102 | + if: ${{ success() }} |
| 103 | + uses: MeilCli/slack-upload-file@v3 |
| 104 | + with: |
| 105 | + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} |
| 106 | + channel_id: ${{ secrets.SLACK_GENERAL_CHANNEL_ID }} |
| 107 | + file_path: 'app/build/outputs/apk/release/app-release.apk' |
| 108 | + file_name: 'WABLE-ANDROID.apk' |
| 109 | + file_type: 'apk' |
| 110 | + initial_comment: '💟 최종 Release가 완료되었습니다 💟' |
| 111 | + |
| 112 | + - name: On Failed, Notify in Slack |
| 113 | + if: ${{ failure() }} |
| 114 | + uses: rtCamp/action-slack-notify@v2 |
| 115 | + env: |
| 116 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 117 | + SLACK_TITLE: '🚫 Release PR check Failed 🚫' |
| 118 | + SLACK_COLOR: '#FF0000' |
| 119 | + MSG_MINIMAL: true |
| 120 | + SLACK_USERNAME: Wable Android |
| 121 | + SLACK_MESSAGE: '️🚫⚠️ Release PR 에러 ️⚠️🚫' |
0 commit comments