pachli-android/.github/workflows/apk-on-comment.yml

87 lines
3.4 KiB
YAML
Raw Normal View History

name: "Build and sign APK for PR"
# Based on https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
issue_comment:
types: [created]
jobs:
deploy:
name: Deploy
# Only run on PR comments containing "/apk"
if: github.event.issue.pull_request && contains(github.event.comment.body, '/apk')
runs-on: ubuntu-latest
steps:
- name: Get branch of PR
chore(deps): pin dependencies (#549) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | pinDigest | -> `b4ffde6` | | [actions/github-script](https://togithub.com/actions/github-script) | action | pinDigest | -> `60a0d83` | | [actions/setup-java](https://togithub.com/actions/setup-java) | action | pinDigest | -> `99b8673` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | pinDigest | -> `5d5d22a` | | [gradle/actions](https://togithub.com/gradle/actions) | action | pinDigest | -> `417ae3c` | | [gradle/wrapper-validation-action](https://togithub.com/gradle/wrapper-validation-action) | action | pinDigest | -> `699bb18` | | [myrotvorets/set-commit-status-action](https://togithub.com/myrotvorets/set-commit-status-action) | action | pinDigest | -> `3730c0a` | | [r0adkll/sign-android-release](https://togithub.com/r0adkll/sign-android-release) | action | pinDigest | -> `dbeba6b` | | [r0adkll/upload-google-play](https://togithub.com/r0adkll/upload-google-play) | action | pinDigest | -> `935ef9c` | | [reviewdog/action-suggester](https://togithub.com/reviewdog/action-suggester) | action | pinDigest | -> `3d7fde6` | | [xt0rted/pull-request-comment-branch](https://togithub.com/xt0rted/pull-request-comment-branch) | action | pinDigest | -> `d97294d` | | [ytanikin/PRConventionalCommits](https://togithub.com/ytanikin/PRConventionalCommits) | action | pinDigest | -> `b7be921` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-21 13:10:59 +01:00
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v2
id: comment-branch
- name: Set latest commit status as pending
chore(deps): pin dependencies (#549) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | pinDigest | -> `b4ffde6` | | [actions/github-script](https://togithub.com/actions/github-script) | action | pinDigest | -> `60a0d83` | | [actions/setup-java](https://togithub.com/actions/setup-java) | action | pinDigest | -> `99b8673` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | pinDigest | -> `5d5d22a` | | [gradle/actions](https://togithub.com/gradle/actions) | action | pinDigest | -> `417ae3c` | | [gradle/wrapper-validation-action](https://togithub.com/gradle/wrapper-validation-action) | action | pinDigest | -> `699bb18` | | [myrotvorets/set-commit-status-action](https://togithub.com/myrotvorets/set-commit-status-action) | action | pinDigest | -> `3730c0a` | | [r0adkll/sign-android-release](https://togithub.com/r0adkll/sign-android-release) | action | pinDigest | -> `dbeba6b` | | [r0adkll/upload-google-play](https://togithub.com/r0adkll/upload-google-play) | action | pinDigest | -> `935ef9c` | | [reviewdog/action-suggester](https://togithub.com/reviewdog/action-suggester) | action | pinDigest | -> `3d7fde6` | | [xt0rted/pull-request-comment-branch](https://togithub.com/xt0rted/pull-request-comment-branch) | action | pinDigest | -> `d97294d` | | [ytanikin/PRConventionalCommits](https://togithub.com/ytanikin/PRConventionalCommits) | action | pinDigest | -> `b7be921` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-21 13:10:59 +01:00
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
- name: Checkout PR branch ${{ steps.comment-branch.outputs.head_ref }} / ${{ steps.comment-branch.outputs.head_sha }}
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
ref: ${{ steps.comment-branch.outputs.head_sha }}
- uses: ./.github/actions/setup-build-env
with:
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Test
run: ./gradlew app:testOrangeGoogleReleaseUnitTest --stacktrace
- name: Build APK
run: ./gradlew assembleOrangeGoogleRelease --stacktrace
chore(deps): pin dependencies (#549) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | pinDigest | -> `b4ffde6` | | [actions/github-script](https://togithub.com/actions/github-script) | action | pinDigest | -> `60a0d83` | | [actions/setup-java](https://togithub.com/actions/setup-java) | action | pinDigest | -> `99b8673` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | pinDigest | -> `5d5d22a` | | [gradle/actions](https://togithub.com/gradle/actions) | action | pinDigest | -> `417ae3c` | | [gradle/wrapper-validation-action](https://togithub.com/gradle/wrapper-validation-action) | action | pinDigest | -> `699bb18` | | [myrotvorets/set-commit-status-action](https://togithub.com/myrotvorets/set-commit-status-action) | action | pinDigest | -> `3730c0a` | | [r0adkll/sign-android-release](https://togithub.com/r0adkll/sign-android-release) | action | pinDigest | -> `dbeba6b` | | [r0adkll/upload-google-play](https://togithub.com/r0adkll/upload-google-play) | action | pinDigest | -> `935ef9c` | | [reviewdog/action-suggester](https://togithub.com/reviewdog/action-suggester) | action | pinDigest | -> `3d7fde6` | | [xt0rted/pull-request-comment-branch](https://togithub.com/xt0rted/pull-request-comment-branch) | action | pinDigest | -> `d97294d` | | [ytanikin/PRConventionalCommits](https://togithub.com/ytanikin/PRConventionalCommits) | action | pinDigest | -> `b7be921` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-21 13:10:59 +01:00
- uses: r0adkll/sign-android-release@dbeba6b98a60b0fd540c02443c7f428cdedf0e7f # v1.0.4
name: Sign app APK
id: sign_app_apk
with:
2024-03-03 20:01:00 +01:00
releaseDirectory: app/build/outputs/apk/orangeGoogle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
- name: Upload APK Release Asset
id: upload-release-asset-apk
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: app-release.apk
path: ${{steps.sign_app_apk.outputs.signedReleaseFile}}
compression-level: 0
- name: Add workflow result as comment on PR
chore(deps): pin dependencies (#549) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | pinDigest | -> `b4ffde6` | | [actions/github-script](https://togithub.com/actions/github-script) | action | pinDigest | -> `60a0d83` | | [actions/setup-java](https://togithub.com/actions/setup-java) | action | pinDigest | -> `99b8673` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | pinDigest | -> `5d5d22a` | | [gradle/actions](https://togithub.com/gradle/actions) | action | pinDigest | -> `417ae3c` | | [gradle/wrapper-validation-action](https://togithub.com/gradle/wrapper-validation-action) | action | pinDigest | -> `699bb18` | | [myrotvorets/set-commit-status-action](https://togithub.com/myrotvorets/set-commit-status-action) | action | pinDigest | -> `3730c0a` | | [r0adkll/sign-android-release](https://togithub.com/r0adkll/sign-android-release) | action | pinDigest | -> `dbeba6b` | | [r0adkll/upload-google-play](https://togithub.com/r0adkll/upload-google-play) | action | pinDigest | -> `935ef9c` | | [reviewdog/action-suggester](https://togithub.com/reviewdog/action-suggester) | action | pinDigest | -> `3d7fde6` | | [xt0rted/pull-request-comment-branch](https://togithub.com/xt0rted/pull-request-comment-branch) | action | pinDigest | -> `d97294d` | | [ytanikin/PRConventionalCommits](https://togithub.com/ytanikin/PRConventionalCommits) | action | pinDigest | -> `b7be921` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-21 13:10:59 +01:00
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
if: always()
with:
script: |
const name = '${{ github.workflow }}';
const workflowUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const apkUrl = '${{ steps.upload-release-asset-apk.outputs.artifact-url }}'
const success = '${{ job.status }}' === 'success';
const body = `Workflow ${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\nResults: ${workflowUrl}\nAPK: ${apkUrl}`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Set latest commit status as ${{ job.status }}
chore(deps): pin dependencies (#549) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | pinDigest | -> `b4ffde6` | | [actions/github-script](https://togithub.com/actions/github-script) | action | pinDigest | -> `60a0d83` | | [actions/setup-java](https://togithub.com/actions/setup-java) | action | pinDigest | -> `99b8673` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | pinDigest | -> `5d5d22a` | | [gradle/actions](https://togithub.com/gradle/actions) | action | pinDigest | -> `417ae3c` | | [gradle/wrapper-validation-action](https://togithub.com/gradle/wrapper-validation-action) | action | pinDigest | -> `699bb18` | | [myrotvorets/set-commit-status-action](https://togithub.com/myrotvorets/set-commit-status-action) | action | pinDigest | -> `3730c0a` | | [r0adkll/sign-android-release](https://togithub.com/r0adkll/sign-android-release) | action | pinDigest | -> `dbeba6b` | | [r0adkll/upload-google-play](https://togithub.com/r0adkll/upload-google-play) | action | pinDigest | -> `935ef9c` | | [reviewdog/action-suggester](https://togithub.com/reviewdog/action-suggester) | action | pinDigest | -> `3d7fde6` | | [xt0rted/pull-request-comment-branch](https://togithub.com/xt0rted/pull-request-comment-branch) | action | pinDigest | -> `d97294d` | | [ytanikin/PRConventionalCommits](https://togithub.com/ytanikin/PRConventionalCommits) | action | pinDigest | -> `b7be921` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/pachli/pachli-android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-21 13:10:59 +01:00
uses: myrotvorets/set-commit-status-action@3730c0a348a2ace3c110851bed53331bc6406e9f # v2.0.1
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}