Skip to content

Commit f044591

Browse files
alperozturk96AndyScherzinger
authored andcommitted
t1
Signed-off-by: alperozturk <[email protected]>
1 parent 9ce8cf4 commit f044591

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

.github/workflows/android.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,27 @@ jobs:
8181
name: app-dev-debug
8282
path: app/build/outputs/apk/dev/debug/app-dev-debug.apk
8383

84-
- name: Comment on PR
85-
if: github.event_name == 'pull_request'
86-
uses: actions/github-script@v7
87-
with:
88-
script: |
89-
github.rest.issues.createComment({
90-
issue_number: context.issue.number,
91-
owner: context.repo.owner,
92-
repo: context.repo.repo,
93-
body: '🎉 Debug APK built and uploaded! You can find it in the [workflow artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).'
94-
})
84+
- name: Upload to Nextcloud and comment
85+
env:
86+
USER: ${{ secrets.NEXTCLOUD_USER }}
87+
PASS: ${{ secrets.NEXTCLOUD_PASSWORD }}
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
BUILD: pr-${{ github.event.pull_request.number }}-${{ github.sha }}
90+
PR: ${{ github.event.pull_request.number }}
91+
PUBLIC_URL: https://www.kaminsky.me/nc-dev/android-artifacts
92+
DAV_URL: https://nextcloud.kaminsky.me/remote.php/dav/files/${{ secrets.NEXTCLOUD_USER }}/android-artifacts
93+
run: |
94+
APK=$(find app/build/outputs/apk/qa/debug -name "qa-debug-*.apk" | head -n1)
95+
[ -f "$APK" ] || { echo "APK not found"; exit 1; }
96+
97+
curl -u "$USER:$PASS" -T "$APK" "$DAV_URL/$BUILD.apk"
98+
qrencode -o "$PR.png" "$PUBLIC_URL/$BUILD.apk"
99+
curl -u "$USER:$PASS" -T "$PR.png" "$DAV_URL/$BUILD.png"
100+
101+
COMMENT="APK file: $PUBLIC_URL/$BUILD.apk\n\n![QR Code]($PUBLIC_URL/$BUILD.png)\n\nTo test this change or fix, download and install the APK above. It can run in parallel to your existing app."
102+
103+
curl -s -X POST \
104+
-H "Authorization: token $GITHUB_TOKEN" \
105+
-H "Content-Type: application/json" \
106+
-d "$(jq -n --arg body "$COMMENT" '{body: $body}')" \
107+
https://api.github.com/repos/${{ github.repository }}/issues/$PR/comments

0 commit comments

Comments
 (0)