Skip to content

feat: add subscription requests #6036

feat: add subscription requests

feat: add subscription requests #6036

Workflow file for this run

name: CI
on:
push:
branches: [ "master" ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TERM: xterm-256color
FORCE_COLOR: 1
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
outputs:
artifact-url: ${{ steps.upload-apk.outputs.artifact-url }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Java
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Decode google-services.json
run: |
set -euo pipefail
if [ -z "${GOOGLE_SERVICES_JSON_BASE64:-}" ]; then
echo "GOOGLE_SERVICES_JSON_BASE64 is empty; using checked-in placeholder."
exit 0
fi
mkdir -p app/src/debug
printf '%s' "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/src/debug/google-services.json
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
- name: Build debug app
id: build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
run: ./gradlew assembleDevDebug
- name: Run tests
run: ./gradlew testDevDebugUnitTest
- name: Upload test report
if: always() && steps.build.outcome == 'success'
uses: actions/upload-artifact@v7
with:
name: unit_test_report_${{ github.run_number }}
path: app/build/reports/tests/testDevDebugUnitTest/
retention-days: 30
- name: Upload APK
id: upload-apk
uses: actions/upload-artifact@v7
with:
name: bitkit-dev-debug-apk_${{ github.run_number }}
path: app/build/outputs/bitkit/devDebug/bitkit-dev-debug-*-universal.apk
retention-days: 30
if-no-files-found: error
apk-comment:
needs: build
if: needs.build.outputs.artifact-url != '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Comment APK link on PR
uses: actions/github-script@v8
env:
ARTIFACT_URL: ${{ needs.build.outputs.artifact-url }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
with:
script: |
const marker = '<!-- bitkit-dev-debug-apk -->';
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const body = [
marker,
'### Regtest APK',
'',
`Built from ${process.env.HEAD_SHA} ([run](${runUrl})).`,
'',
`[Download bitkit-dev-debug universal APK](${process.env.ARTIFACT_URL}) (expires in 30 days).`,
].join('\n');
const comments = await github.paginate(github.rest.issues.listComments, {
...context.repo,
issue_number: context.issue.number,
per_page: 100,
});
const existing = comments.find((c) => c.body?.includes(marker));
if (existing) {
await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
} else {
await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
}