Skip to content

fix/#77: APK 빌드 후 배포하도록 수정 #168

fix/#77: APK 빌드 후 배포하도록 수정

fix/#77: APK 빌드 후 배포하도록 수정 #168

Workflow file for this run

name: BuyOrNot CI
on:
push:
branches:
- main
- develop
pull_request:
jobs:
ktlint:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
concurrency:
group: ktlint-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Create local.properties
run: |
echo "signed.store.file=keystore.jks" >> local.properties
echo "signed.store.password=${{ secrets.SIGNED_STORE_PASSWORD }}" >> local.properties
echo "signed.key.alias=${{ secrets.SIGNED_KEY_ALIAS }}" >> local.properties
echo "signed.key.password=${{ secrets.SIGNED_KEY_PASSWORD }}" >> local.properties
echo "debug.base.url=${{ secrets.DEBUG_BASE_URL }}" >> local.properties
echo "release.base.url=${{ secrets.RELEASE_BASE_URL }}" >> local.properties
- name: Decode Keystore
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks
- name: Configure Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run ktlint check
id: ktlint
run: ./gradlew ktlintCheck
continue-on-error: true
- name: Fail with guide message (fork PR)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::ktlint 검사에 실패했습니다. Fork PR은 자동 포맷팅이 지원되지 않습니다."
echo "::error::로컬에서 ./gradlew ktlintFormat 실행 후 다시 push 해주세요."
exit 1
- name: Auto-fix with ktlintFormat (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: ./gradlew ktlintFormat
- name: Commit and push ktlint fixes (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
ISSUE=$(echo "$BRANCH" | grep -oP '#\d+' | head -1)
if [ -n "$ISSUE" ]; then
MSG="chore/${ISSUE}: ktlint 포맷팅"
else
MSG="chore: ktlint 포맷팅"
fi
git diff --quiet || (git add -A && git commit -m "$MSG")
git push origin HEAD:${GITHUB_HEAD_REF}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail if ktlint had errors (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: exit 1