diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f314867..042f260 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,3 +46,30 @@ jobs: files: app/build/outputs/apk/release/MonthlyPaymentApp-${{ github.ref_name }}.apk env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update update.json after release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG_NAME="${{ github.ref_name }}" + VERSION_NAME="${TAG_NAME#v}" + VERSION_CODE=$(grep 'versionCode' app/build.gradle.kts | head -n 1 | awk '{print $3}') + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git fetch origin main + git checkout main + + cat < update.json + { + "versionCode": ${VERSION_CODE}, + "versionName": "${VERSION_NAME}", + "url": "https://github.com/oqba26/MonthlyPaymentApp/releases/download/${TAG_NAME}/MonthlyPaymentApp-${TAG_NAME}.apk", + "releaseNotes": "بهبودهای پایداری و عملکرد همگام‌سازی", + "isForceUpdate": false + } + EOF + + git add update.json + git commit -m "auto-update update.json for release ${TAG_NAME}" || true + git push origin main