Merge pull request #120 from THT-Team/develop #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CD | |
on: | |
push: | |
branches: [main, qa] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Cache Gradle packages | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Access APP_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json | |
- name: Access DATA_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json | |
- name: Add Key Info into local.properties | |
run: | | |
touch ./local.properties | |
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties | |
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties | |
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties | |
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties | |
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties | |
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties | |
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties | |
cat ./local.properties | |
env: | |
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }} | |
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} | |
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }} | |
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }} | |
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }} | |
CEO_EMAIL: ${{ secrets.CEO_EMAIL }} | |
- name: Build with Gradle Without Test | |
run: ./gradlew build -x test | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Access APP_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json | |
- name: Access DATA_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json | |
- name: Add Key Info into local.properties | |
run: | | |
touch ./local.properties | |
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties | |
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties | |
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties | |
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties | |
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties | |
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties | |
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties | |
cat ./local.properties | |
env: | |
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }} | |
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} | |
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }} | |
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }} | |
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }} | |
CEO_EMAIL: ${{ secrets.CEO_EMAIL }} | |
- name: Run unit tests | |
run: ./gradlew testDebugUnitTest | |
- name: Create android test report | |
uses: asadmansr/[email protected] | |
if: ${{ always() }} | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Cache Gradle packages | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Add Key Info into local.properties | |
run: | | |
touch ./local.properties | |
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties | |
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties | |
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties | |
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties | |
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties | |
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties | |
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties | |
cat ./local.properties | |
env: | |
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }} | |
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} | |
REGION_CODE_SERVICE_KEY: ${{ secrets.REGION_CODE_SERVICE_KEY }} | |
APP_EMAIL_ID: ${{ secrets.APP_EMAIL_ID }} | |
APP_EMAIL_PASSWORD: ${{ secrets.APP_EMAIL_PASSWORD }} | |
CEO_EMAIL: ${{ secrets.CEO_EMAIL }} | |
- name: Access APP_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.APP_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json | |
- name: Access DATA_GOOGLE_SERVICES_JSON | |
run: echo '${{ secrets.DATA_GOOGLE_SERVICES_JSON }}' > ./data/google-services.json | |
- name: Gradel Release Build | |
run: ./gradlew assembleRelease | |
- name: Sign APK | |
id: sign_apk | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.KEY_BASE_64_RELEASE }} | |
alias: ${{ secrets.KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Firebase App Distribution | |
uses: wzieba/Firebase-Distribution-Github-Action@v1 | |
with: | |
appId: ${{secrets.FIREBASE_APP_ID}} | |
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} | |
groups: android-developer, tht-team | |
file: app/build/outputs/apk/release/app-release-unsigned-signed.apk | |
releaseNotesFile: app/release_note.md | |
alert: | |
runs-on: ubuntu-latest | |
needs: [build, release, test] | |
steps: | |
- name: action-slack | |
uses: 8398a7/[email protected] | |
with: | |
status: ${{ job.status }} | |
author_name: THT-Android CI | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', | |
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`, | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: always() # Pick up events even if the job fails or is canceled. |