android-build.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # SPDX-FileCopyrightText: 2022 suyu Emulator Project
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. name: 'suyu-android-build'
  4. on:
  5. push:
  6. tags: [ "*" ]
  7. jobs:
  8. android:
  9. runs-on: ubuntu-latest
  10. if: ${{ github.repository == 'suyu-emu/suyu-android' }}
  11. steps:
  12. - uses: actions/checkout@v3
  13. with:
  14. submodules: recursive
  15. fetch-depth: 0
  16. - name: Set up JDK 17
  17. uses: actions/setup-java@v3
  18. with:
  19. java-version: '17'
  20. distribution: 'temurin'
  21. - name: Set up cache
  22. uses: actions/cache@v3
  23. with:
  24. path: |
  25. ~/.gradle/caches
  26. ~/.gradle/wrapper
  27. ~/.ccache
  28. key: ${{ runner.os }}-android-${{ github.sha }}
  29. restore-keys: |
  30. ${{ runner.os }}-android-
  31. - name: Query tag name
  32. uses: olegtarasov/get-tag@v2.1.2
  33. id: tagName
  34. - name: Install dependencies
  35. run: |
  36. sudo apt-get update
  37. sudo apt-get install -y ccache apksigner glslang-dev glslang-tools
  38. - name: Build
  39. run: ./.ci/scripts/android/build.sh
  40. env:
  41. ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
  42. ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
  43. ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
  44. - name: Copy artifacts
  45. run: ./.ci/scripts/android/upload.sh
  46. - name: Upload
  47. uses: actions/upload-artifact@v3
  48. with:
  49. name: android
  50. path: artifacts/
  51. # release steps
  52. release-android:
  53. runs-on: ubuntu-latest
  54. needs: [android]
  55. if: ${{ startsWith(github.ref, 'refs/tags/') }}
  56. permissions:
  57. contents: write
  58. steps:
  59. - uses: actions/download-artifact@v3
  60. - name: Query tag name
  61. uses: olegtarasov/get-tag@v2.1.2
  62. id: tagName
  63. - name: Create release
  64. uses: actions/create-release@v1
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  67. with:
  68. tag_name: ${{ steps.tagName.outputs.tag }}
  69. release_name: ${{ steps.tagName.outputs.tag }}
  70. draft: false
  71. prerelease: false
  72. - name: Upload artifacts
  73. uses: alexellis/upload-assets@0.2.3
  74. env:
  75. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  76. with:
  77. asset_paths: '["./**/*.apk","./**/*.aab"]'