From 7265265ec1236ceb54b75bd1c2d40da37d8cac9f Mon Sep 17 00:00:00 2001 From: hyeseon Date: Sat, 26 Oct 2024 23:25:55 +0900 Subject: [PATCH] =?UTF-8?q?[add]=20#312=20Github=20Actions=20=EB=A5=BC=20?= =?UTF-8?q?=ED=99=9C=EC=9A=A9=ED=95=9C=20CD=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/winey-cd.yml | 81 +++++++++++++++++++ .../{pr_checker.yml => winey-ci.yml} | 0 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/winey-cd.yml rename .github/workflows/{pr_checker.yml => winey-ci.yml} (100%) diff --git a/.github/workflows/winey-cd.yml b/.github/workflows/winey-cd.yml new file mode 100644 index 00000000..47a7bfd4 --- /dev/null +++ b/.github/workflows/winey-cd.yml @@ -0,0 +1,81 @@ +# JVM 옵션을 설정, 최대 힙 메모리를 4GB로 +env: + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false" + GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true +# main 브랜치에 PR을 올릴 시 트리거 +on: + pull_request: + branches: + - develop + +jobs: + cd-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: 17 + + - name: Generate winey.keystore.jks + run: echo '${{ secrets.WINEY_KEYSTORE }}' | base64 -d > ./app/winey.jks + + - name: Generate local.properties + env: + AUTH_BASE_URL: ${{ secrets.AUTH_BASE_URL }} + KAKAO_NATIVE_KEY: ${{ secrets.KAKAO_NATIVE_KEY }} + AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + run: | + echo "auth.base.url=$AUTH_BASE_URL" >> ./local.properties + echo "kakao.native.key=$KAKAO_NATIVE_KEY" >> ./local.properties + echo "amplitude.api.key=$AMPLITUDE_API_KEY" >> ./local.properties + echo "kakaoNativeKey=$KAKAO_NATIVE_KEY" >> ./local.properties + echo "keyAlias=$KEY_ALIAS" >> ./local.properties + echo "keyPassword=$KEY_PASSWORD" >> ./local.properties + echo "storePassword=$STORE_PASSWORD" >> ./local.properties + + - name: Generate google-services.json + run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' | base64 --d > ./app/google-services.json + + # PR 제목에서 release v*.*.* 형식의 버전을 추출 + - name: Extract Version Name + run: echo "##[set-output name=version;]v$(echo '${{ github.event.pull_request.title }}' | grep -oP 'release v\K[0-9]+\.[0-9]+\.[0-9]+')" + id: extract_version + + - name: Build Release APK + run: | + ./gradlew :app:assembleRelease + + # GitHub Actions Artifacts에 릴리즈 apk 추출 + - name: Upload Release Build to Artifacts + uses: actions/upload-artifact@v3 + with: + name: release-artifacts + path: app/build/outputs/apk/release/ + if-no-files-found: error + + - name: Create Github Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.extract_version.outputs.version }} + release_name: ${{ steps.extract_version.outputs.version }} + generate_release_notes: true + files: | + app/build/outputs/apk/release/app-release.apk + + - name: Upload artifact to Firebase App Distribution + uses: wzieba/Firebase-Distribution-Github-Action@v1 + with: + appId: ${{secrets.FIREBASE_APP_ID}} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + groups: testers + file: app/build/outputs/apk/release/app-release.apk diff --git a/.github/workflows/pr_checker.yml b/.github/workflows/winey-ci.yml similarity index 100% rename from .github/workflows/pr_checker.yml rename to .github/workflows/winey-ci.yml