خودکارسازی آپدیت update.json پس از انتشار موفق APK در گیتهاب اکشن
Android Release / build (push) Canceled after 0s
Android Release / build (push) Canceled after 0s
This commit is contained in:
1 parent
6166a2f249
commit
fcf4d02caf
1 file changed
+27
@@ -46,3 +46,30 @@ jobs:
|
|||||||
files: app/build/outputs/apk/release/MonthlyPaymentApp-${{ github.ref_name }}.apk
|
files: app/build/outputs/apk/release/MonthlyPaymentApp-${{ github.ref_name }}.apk
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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 <<EOF > 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
|
||||||
Reference in new issue
Block a user