diff --git a/.github/workflows/build-debug-apk.yml b/.github/workflows/build-debug-apk.yml new file mode 100644 index 0000000..49688b5 --- /dev/null +++ b/.github/workflows/build-debug-apk.yml @@ -0,0 +1,43 @@ +name: default + +on: + push: + paths: + - 'app/src/**' + pull_request: + paths: + - 'app/src/**' +permissions: + pull-requests: write + +jobs: + build-debug-apk: + needs: [lint] + if: github.event_name == 'pull_request' + uses: ./.github/workflows/build-apk.yml + with: + build-type: debug + secrets: + key-alias: ${{ secrets.DEBUG_KEY_ALIAS }} + keystore: ${{ secrets.DEBUG_KEYSTORE_B64 }} + key-password: ${{ secrets.DEBUG_KEY_PASSWORD }} + post-apk-link: + needs: [build-debug-apk] + runs-on: ubuntu-latest + steps: + - name: Post link to action run detail page + uses: actions/github-script@v6 + with: + script: | + try { + const commentResult = await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `APK build completed! Visit [action run detail page](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) to download the APK to test this pull request.` + }) + console.log(commentResult) + } catch (e) { + console.log("Comment not posted:") + console.log(e) + } diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index c24f4ab..412c4d0 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -22,36 +22,6 @@ jobs: with: report-path: build/*.xml # Support glob patterns by https://www.npmjs.com/package/@actions/glob continue-on-error: false # If annotations contain error of severity, action-ktlint exit 1. - build-debug-apk: - needs: [lint] - if: github.event_name == 'pull_request' - uses: ./.github/workflows/build-apk.yml - with: - build-type: debug - secrets: - key-alias: ${{ secrets.DEBUG_KEY_ALIAS }} - keystore: ${{ secrets.DEBUG_KEYSTORE_B64 }} - key-password: ${{ secrets.DEBUG_KEY_PASSWORD }} - post-apk-link: - needs: [build-debug-apk] - runs-on: ubuntu-latest - steps: - - name: Post link to action run detail page - uses: actions/github-script@v6 - with: - script: | - try { - const commentResult = await github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `APK build completed! Visit [action run detail page](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) to download the APK to test this pull request.` - }) - console.log(commentResult) - } catch (e) { - console.log("Comment not posted:") - console.log(e) - } build-release-apk: needs: [lint] if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')