Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 89 additions & 7 deletions .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
- uses: gradle/gradle-build-action@v3

- name: GitHub Actor
env:
GITHUB_ACTOR: ${{ github.actor }}
env:
GITHUB_ACTOR: ${{ github.actor }}
run: echo "$GITHUB_ACTOR"

- name: GitHub Triggering Actor
env:
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
env:
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
run: echo "$GITHUB_TRIGGERING_ACTOR"

- name: Git Config
Expand All @@ -36,9 +36,10 @@ jobs:
- name: Set the new versionName as an environment variable
id: get_version_name
run: |
./gradlew getVersionName --quiet --console=plain
VERSION_NAME="$(./gradlew getVersionName --quiet --console=plain)"
echo "::set-output name=version_name::$VERSION_NAME"
./gradlew app:getVersionName --quiet --console=plain
VERSION_NAME="$(./gradlew app:getVersionName --quiet --console=plain)"
echo "VERSION_NAME $VERSION_NAME"
echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT

- name: Git Commit
run: |
Expand Down Expand Up @@ -77,3 +78,84 @@ jobs:
- name: Git Push
run: |
git push
outputs:
tagName: ${{ steps.get_version_name.outputs.version_name }}

release_apk:
needs: create_git_tag
runs-on: ubuntu-latest
steps:
- name: Get the Git Tag name from the previous job
run: echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"

- name: Checkout refs/tags/${{ needs.create_git_tag.outputs.tagName }}
uses: actions/checkout@v4
with:
ref: refs/tags/${{ needs.create_git_tag.outputs.tagName }}

- name: Assemble APK file
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- uses: gradle/gradle-build-action@v3

- name: Assemble `release` build
run: ./gradlew assembleRelease

- name: Sign the APK file
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGN_ANDROID_KEY }}
alias: ${{ secrets.SIGN_ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.SIGN_ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.SIGN_ANDROID_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- run: echo "signedReleaseFile ${{steps.sign_app.outputs.signedReleaseFile}}"

- name: Rename signed release file to `ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk`
run: mv ${{steps.sign_app.outputs.signedReleaseFile}} app/build/outputs/apk/release/ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk

- name: Upload the signed APK file to GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: '${{ needs.create_git_tag.outputs.tagName }}'
files: app/build/outputs/apk/release/ai.elimu.content-provider-${{ needs.create_git_tag.outputs.tagName }}.apk
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Prepare the APK file URL
id: prepare_apk_file_url
run: |
echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"
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"
echo "APK_FILE_URL $APK_FILE_URL"
echo "apk_file_url=$APK_FILE_URL" >> $GITHUB_OUTPUT
outputs:
apkFileUrl: ${{ steps.prepare_apk_file_url.outputs.apk_file_url }}

notify_webapp_api:
needs: [ create_git_tag, release_apk ]
strategy:
matrix:
language_code: [ eng, hin, tgl, tha, vie ]
runs-on: ubuntu-latest
steps:
- name: Get the Git Tag name from previous job
run: echo "tagName ${{ needs.create_git_tag.outputs.tagName }}"

- name: Get the APK file URL from previous job
run: echo "apkFileUrl ${{ needs.release_apk.outputs.apkFileUrl }}"

- name: Send HTTP request to `${{ matrix.language_code }}.elimu.ai`
uses: fjogeleit/http-request-action@v1
with:
url: http://${{ matrix.language_code }}.elimu.ai/rest/v2/applications/ai.elimu.content_provider/application-versions/${{ needs.create_git_tag.outputs.tagName }}
method: PUT
data: '{"fileUrl": "${{ needs.release_apk.outputs.apkFileUrl }}"}'
customHeaders: '{"Content-Type": "application/json"}'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ To perform a release, follow these steps:

1. Merge your PR into the `main` branch
1. Wait for the ["Gradle Release"](https://github.com/elimu-ai/content-provider/actions/workflows/gradle-release.yml) workflow to complete
1. Ensure that the new release version appears at https://jitpack.io/#ai.elimu/content-provider with "Status: ok"
1. Ensure that the new release version appears at https://github.com/elimu-ai/content-provider/releases

> [!IMPORTANT]
> After you publish a new release, remember to also bump the version in all Android app repos that depend on the `utils` library:
Expand Down
Loading