@@ -16,13 +16,13 @@ jobs:
1616 - uses : gradle/gradle-build-action@v3
1717
1818 - name : GitHub Actor
19- env :
20- GITHUB_ACTOR : ${{ github.actor }}
19+ env :
20+ GITHUB_ACTOR : ${{ github.actor }}
2121 run : echo "$GITHUB_ACTOR"
2222
2323 - name : GitHub Triggering Actor
24- env :
25- GITHUB_TRIGGERING_ACTOR : ${{ github.triggering_actor }}
24+ env :
25+ GITHUB_TRIGGERING_ACTOR : ${{ github.triggering_actor }}
2626 run : echo "$GITHUB_TRIGGERING_ACTOR"
2727
2828 - name : Git Config
3636 - name : Set the new versionName as an environment variable
3737 id : get_version_name
3838 run : |
39- ./gradlew getVersionName --quiet --console=plain
40- VERSION_NAME="$(./gradlew getVersionName --quiet --console=plain)"
41- echo "::set-output name=version_name::$VERSION_NAME"
39+ ./gradlew app:getVersionName --quiet --console=plain
40+ VERSION_NAME="$(./gradlew app:getVersionName --quiet --console=plain)"
41+ echo "VERSION_NAME $VERSION_NAME"
42+ echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT
4243
4344 - name : Git Commit
4445 run : |
7778 - name : Git Push
7879 run : |
7980 git push
81+ outputs :
82+ tagName : ${{ steps.get_version_name.outputs.version_name }}
83+
84+ release_apk :
85+ needs : create_git_tag
86+ runs-on : ubuntu-latest
87+ steps :
88+ - name : Get the Git Tag name from the previous job
89+ run : echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"
90+
91+ - name : Checkout refs/tags/${{ needs.create_git_tag.outputs.tagName }}
92+ uses : actions/checkout@v4
93+ with :
94+ ref : refs/tags/${{ needs.create_git_tag.outputs.tagName }}
95+
96+ - name : Assemble APK file
97+ uses : actions/setup-java@v4
98+ with :
99+ distribution : temurin
100+ java-version : 17
101+
102+ - uses : gradle/gradle-build-action@v3
103+
104+ - name : Assemble `release` build
105+ run : ./gradlew assembleRelease
106+
107+ - name : Sign the APK file
108+ uses : r0adkll/sign-android-release@v1
109+ id : sign_app
110+ with :
111+ releaseDirectory : app/build/outputs/apk/release
112+ signingKeyBase64 : ${{ secrets.SIGN_ANDROID_KEY }}
113+ alias : ${{ secrets.SIGN_ANDROID_ALIAS }}
114+ keyStorePassword : ${{ secrets.SIGN_ANDROID_KEY_STORE_PASSWORD }}
115+ keyPassword : ${{ secrets.SIGN_ANDROID_KEY_PASSWORD }}
116+ env :
117+ BUILD_TOOLS_VERSION : " 34.0.0"
118+
119+ - run : echo "signedReleaseFile ${{steps.sign_app.outputs.signedReleaseFile}}"
120+
121+ - name : Rename signed release file to `ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk`
122+ run : mv ${{steps.sign_app.outputs.signedReleaseFile}} app/build/outputs/apk/release/ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk
123+
124+ - name : Upload the signed APK file to GitHub release
125+ uses : softprops/action-gh-release@v2
126+ with :
127+ tag_name : ' ${{ needs.create_git_tag.outputs.tagName }}'
128+ files : app/build/outputs/apk/release/ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk
129+ env :
130+ GITHUB_TOKEN : ${{ github.token }}
131+
132+ - name : Prepare the APK file URL
133+ id : prepare_apk_file_url
134+ run : |
135+ echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"
136+ APK_FILE_URL="https://github.com/elimu-ai/content-provider/releases/download/${{ needs.create_git_tag.outputs.tagName }}/ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk"
137+ echo "APK_FILE_URL $APK_FILE_URL"
138+ echo "apk_file_url=$APK_FILE_URL" >> $GITHUB_OUTPUT
139+ outputs :
140+ apkFileUrl : ${{ steps.prepare_apk_file_url.outputs.apk_file_url }}
141+
142+ notify_webapp_api :
143+ needs : [ create_git_tag, release_apk ]
144+ strategy :
145+ matrix :
146+ language_code : [ eng, hin, tgl, tha, vie ]
147+ runs-on : ubuntu-latest
148+ steps :
149+ - name : Get the Git Tag name from previous job
150+ run : echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"
151+
152+ - name : Get the APK file URL from previous job
153+ run : echo "apkFileUrl ${{ needs.release_apk.outputs.apkFileUrl }}"
154+
155+ - name : Send HTTP request to `${{ matrix.language_code }}.elimu.ai`
156+ uses : fjogeleit/http-request-action@v1
157+ with :
158+ url : http://${{ matrix.language_code }}.elimu.ai/rest/v2/applications/ai.elimu.content_provider/application-versions/${{ needs.create_git_tag.outputs.tagName }}
159+ method : PUT
160+ data : ' {"fileUrl": "${{ needs.release_apk.outputs.apkFileUrl }}"}'
161+ customHeaders : ' {"Content-Type": "application/json"}'
0 commit comments