main.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # This is a basic workflow to help you get started with Actions
  2. name: Build
  3. # Controls when the action will run.
  4. on:
  5. # Triggers the workflow on push or pull request events but only for the master branch
  6. push:
  7. branches: [ master ]
  8. paths-ignore:
  9. - '**/README.md'
  10. pull_request:
  11. branches: [ master ]
  12. # Allows you to run this workflow manually from the Actions tab
  13. workflow_dispatch:
  14. # A workflow run is made up of one or more jobs that can run sequentially or in parallel
  15. jobs:
  16. # This workflow contains a single job called "build"
  17. build:
  18. # The type of runner that the job will run on
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: set up JDK 1.8
  23. uses: actions/setup-java@v1
  24. with:
  25. java-version: 1.8
  26. - name: Grant execute permission for gradlew
  27. run: chmod +x gradlew
  28. - name: Build with Gradle
  29. run: ./gradlew packageDebugUniversalApk
  30. - name: Get app version
  31. run: echo "APP_VERSION=v$(cat ./app/build.gradle | grep -m1 versionName | awk -F \" '{print $2}')" >> $GITHUB_ENV
  32. - name: Get app name
  33. run: echo "APP_NAME=PenguinsRead-DEBUG#${{ github.run_number }}" >> $GITHUB_ENV
  34. - name: Rename the APK file
  35. run: mv ./app/build/outputs/universal_apk/debug/app-debug-universal.apk ./${{ env.APP_NAME }}.apk
  36. - name: Store generated APK file
  37. uses: actions/upload-artifact@v1
  38. with:
  39. name: ${{ env.APP_NAME }}
  40. path: ./${{ env.APP_NAME }}.apk