build-gradle-project.yml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Build Gradle project
  2. # on settings
  3. on:
  4. push:
  5. branches:
  6. - master
  7. - main
  8. # permissions
  9. permissions:
  10. contents: write
  11. deployments: write
  12. pages: write
  13. # jobs
  14. jobs:
  15. build-gradle-project:
  16. runs-on: ubuntu-latest
  17. # job steps
  18. steps:
  19. - uses: actions/setup-python@v4
  20. with:
  21. python-version: 3.x
  22. # check out sources
  23. - name: Checkout project sources
  24. id: checkout_project
  25. uses: actions/checkout@v4.1.4
  26. # build docker todo
  27. #- name: Build and publish Docker Image to GitHub Registry with custom Dockerfile
  28. #uses: banool/gp-docker-action@1.0.2
  29. #with:
  30. #github-token: ${{ secrets.GITHUB_TOKEN }}
  31. #image-name: mjdev-android
  32. #build-context: ./
  33. # setup jdk 17
  34. - name: Set up JDK 17
  35. id: setup_java
  36. uses: actions/setup-java@v4.2.1
  37. with:
  38. java-version: '17'
  39. distribution: 'temurin'
  40. cache: gradle
  41. # setup gradle
  42. - name: Setup Gradle
  43. id: setup_gradle
  44. uses: gradle/actions/setup-gradle@v3
  45. # be sure it is executable
  46. - name: Grant execute permission for gradlew
  47. id: grant_gradle
  48. run: chmod +x gradlew
  49. # generate version number to env
  50. - name: Prepare Version Number
  51. id: prepare_version
  52. run: |
  53. export GRADLE_PATH="./config/version.app.prop";
  54. export GRADLE_FIELD_VMAJ="majorVersion"
  55. export GRADLE_FIELD_VMIN="minorVersion"
  56. export GRADLE_FIELD_VPAT="patchVersion"
  57. export VERSION_VMAJ_TMP=$(grep $GRADLE_FIELD_VMAJ $GRADLE_PATH | cat $2)
  58. export VERSION_VMIN_TMP=$(grep $GRADLE_FIELD_VMIN $GRADLE_PATH | cat $2)
  59. export VERSION_VMPAT_TMP=$(grep $GRADLE_FIELD_VPAT $GRADLE_PATH | cat $2)
  60. export VERSION_MAJOR=$(echo $VERSION_VMAJ_TMP | sed -e 's/^majorVersion=//' -e 's/"$//')
  61. export VERSION_MINOR=$(echo $VERSION_VMIN_TMP | sed -e 's/^minorVersion=//' -e 's/"$//')
  62. export VERSION_PATCH=$(echo $VERSION_VMPAT_TMP | sed -e 's/^patchVersion=//' -e 's/"$//')
  63. export APP_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
  64. echo "Release Version : $APP_VERSION"
  65. echo "GITHUB_APP_VERSION_NAME=$(echo $APP_VERSION)" >> $GITHUB_ENV
  66. # build apk for release
  67. - name: Build Release APK
  68. id: build_release_apk
  69. run: ./gradlew --stacktrace clean assembleRelease
  70. # publish github release
  71. - name: Create Release
  72. id: release
  73. uses: ncipollo/release-action@v1.14.0
  74. with:
  75. name: Release v ${{ env.GITHUB_APP_VERSION_NAME }}
  76. allowUpdates: true
  77. token: ${{ secrets.TOKEN }}
  78. tag: release-${{ env.GITHUB_APP_VERSION_NAME }}
  79. artifacts: './app/build/outputs/apk/release/app-release.apk, ./documentation/release-notes-*.md, ./release.zip, ./dependencies.md'
  80. - uses: actions/cache@v2
  81. with:
  82. key: ${{ github.ref }}
  83. path: .cache
  84. - run: pip install mkdocs-material
  85. - run: pip install mkdocs-glightbox
  86. - run: mkdocs gh-deploy --force
  87. # update wiki pages
  88. - name: Update wiki pages
  89. id: update_wiki_pages
  90. run: chmod a+x ./scripts/update-wiki.sh && ./scripts/update-wiki.sh
  91. shell: bash
  92. env:
  93. WIKI_DIR: './documentation'
  94. GH_TOKEN: ${{ secrets.TOKEN }}
  95. # done