[init] discord 연동 #7
Workflow file for this run
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: DATEROAD CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- develop | |
defaults: | |
run: | |
shell: bash | |
working-directory: . | |
jobs: | |
build: | |
name: CD | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Change gradlew permissions | |
run: chmod +x ./gradlew | |
- name: Touch local properties | |
run: touch local.properties | |
- name: Decode google-services.json | |
env: | |
FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} | |
run: echo $FIREBASE_SECRET > app/google-services.json | |
- name: Access local properties | |
env: | |
HFM_BASE_URL: ${{ secrets.BASE_URL }} | |
IO_SENTRY_TOKEN: ${{ secrets.IO_SENTRY_DSN }} | |
KAKAO_NATIVE_APP_KEY_MANIFEST: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
run: | | |
echo "dev.base.url=\"$BASE_URL\"" >> local.properties | |
echo "io.sentry.dsn=\"$IO_SENTRY_DSN\"" >> local.properties | |
echo "kakao.native.app.key.manifest=\"$KAKAO_NATIVE_APP_KEY_MANIFEST\"" >> local.properties | |
echo "kakao.native.app.key=\"$KAKAO_NATIVE_APP_KEY\"" >> local.properties | |
- name: Access sentry properties | |
env: | |
DEFAULTS_ORG: ${{ secrets.DEFAULTS_ORG }} | |
DEFAULTS_PROJECT: ${{ secrets.DEFAULTS_PROJECT }} | |
run: | | |
echo "defaults.org=$DEFAULTS_ORG" >> sentry.properties | |
echo "defaults.project=$DEFAULTS_PROJECT" >> sentry.properties | |
- name: Build Release APK | |
run: | | |
./gradlew :app:assembleRelease | |
- name: Upload Release APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release | |
path: ./app/build/outputs/apk/release/app-release-unsigned.apk | |
- name: Get Release APK Download URL | |
id: get-artifact-url | |
run: | | |
ARTIFACTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts") | |
ARTIFACT_ID=$(echo "$ARTIFACTS" | jq -r '.artifacts[] | select(.name=="release") | .id') | |
if [ -z "$ARTIFACT_ID" ]; then | |
echo "Artifact ID not found. Exiting." | |
exit 1 | |
fi | |
DOWNLOAD_URL="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${ARTIFACT_ID}/zip" | |
echo "::set-output name=url::$DOWNLOAD_URL" | |
- name: Discord Notify - Success | |
if: ${{ success() }} | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
title: ✅ Release Test가 완료되었습니다! 🔥 | |
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
color: B7FF1D | |
username: DATEROAD-ANDROID 🍫 | |
content: | | |
Release Test가 완료되었습니다! | |
[❇️ APK를 다운로드해 보세요! ❇️](${{ steps.get-artifact-url.outputs.url }}) | |
- name: Discord Notify - Failure | |
if: ${{ failure() }} | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
title: ❌ Release Test Failed ❌ | |
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
color: FF0000 | |
username: DATEROAD-ANDROID 🍫 | |
content: 에러를 확인해 주세요 🫨 |