update ondemand workflow & fix CI #4700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android Debug artifact ondemand | |
on: | |
pull_request: | |
types: [opened] | |
issue_comment: | |
types: [created] | |
jobs: | |
apk: | |
runs-on: ubuntu-latest | |
if: github.event.comment.body == 'Build test apk' && (github.actor == 'VishalNehra' || github.actor == 'TranceLove' || github.actor == 'EmmanuelMess' || github.actor == 'VishnuSanal') | |
steps: | |
- name: Acknowledge the request with thumbs up reaction | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
comment-id: ${{ github.event.comment.id }} | |
reactions: '+1' | |
- name: Github API Request | |
id: request | |
uses: octokit/[email protected] | |
with: | |
route: ${{ github.event.issue.pull_request.url }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get PR informations | |
id: pr_data | |
run: | | |
echo "::set-output name=repo_name::${{ fromJson(steps.request.outputs.data).head.repo.full_name }}" | |
echo "::set-output name=repo_clone_url::${{ fromJson(steps.request.outputs.data).head.repo.clone_url }}" | |
echo "::set-output name=repo_ssh_url::${{ fromJson(steps.request.outputs.data).head.repo.ssh_url }}" | |
- name: Checkout PR Branch | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{fromJson(steps.request.outputs.data).head.repo.full_name}} | |
ref: ${{fromJson(steps.request.outputs.data).head.ref}} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 11 | |
- name: Build with Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
arguments: assembleDebug --stacktrace | |
- name: Upload fdroid artifact | |
uses: actions/upload-artifact@v4 | |
id: artifact-upload-fdroid | |
with: | |
name: Amaze-Fdroid-debug | |
path: app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk | |
if-no-files-found: error | |
- name: Upload play artifact | |
uses: actions/upload-artifact@v4 | |
id: artifact-upload-play | |
with: | |
name: Amaze-Play-debug | |
path: app/build/outputs/apk/play/debug/app-play-debug.apk | |
if-no-files-found: error | |
- name: Get the PR number | |
id: find-pr-id | |
run: | | |
PR_NUMBER=$(jq --raw-output .issue.number "$GITHUB_EVENT_PATH") | |
echo "PR_Number: $PR_NUMBER" | |
echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_OUTPUT" | |
- name: Notify the user with a comment once the APK is uploaded | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ steps.find-pr-id.outputs.PR_NUMBER }} | |
body: | | |
Requested APKs have been built. Please find them from the links below. | |
FDroid Flavour: ${{ steps.artifact-upload-fdroid.outputs.artifact-url }} | |
Play Flavour: ${{ steps.artifact-upload-play.outputs.artifact-url }} | |
PS: you should be logged in to access the artifacts. |