You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.2 KiB

  1. name: Android
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - 'src/**'
  7. - 'examples/**'
  8. - '.github/workflows/android.yml'
  9. pull_request:
  10. paths:
  11. - 'src/**'
  12. - 'examples/**'
  13. - '.github/workflows/android.yml'
  14. release:
  15. types: [published]
  16. permissions:
  17. contents: read
  18. jobs:
  19. build:
  20. permissions:
  21. contents: write # for actions/upload-release-asset to upload release asset
  22. runs-on: windows-latest
  23. strategy:
  24. fail-fast: false
  25. max-parallel: 1
  26. matrix:
  27. ARCH: ["arm64", "x86_64"]
  28. env:
  29. RELEASE_NAME: raylib-dev_android_api29_${{ matrix.ARCH }}
  30. steps:
  31. - name: Checkout
  32. uses: actions/checkout@master
  33. - name: Setup Release Version
  34. run: |
  35. echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_android_api29_${{ matrix.ARCH }}" >> $GITHUB_ENV
  36. shell: bash
  37. if: github.event_name == 'release' && github.event.action == 'published'
  38. - name: Setup Android NDK
  39. id: setup-ndk
  40. uses: nttld/setup-ndk@v1
  41. with:
  42. ndk-version: r25
  43. add-to-path: false
  44. env:
  45. ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
  46. - name: Setup Environment
  47. run: |
  48. mkdir build
  49. cd build
  50. mkdir ${{ env.RELEASE_NAME }}
  51. cd ${{ env.RELEASE_NAME }}
  52. mkdir include
  53. mkdir lib
  54. cd ../..
  55. # Generating static + shared library for 64bit arquitectures and API version 29
  56. - name: Build Library
  57. run: |
  58. cd src
  59. make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
  60. make PLATFORM=PLATFORM_ANDROID ANDROID_ARCH=${{ matrix.ARCH }} ANDROID_API_VERSION=29 ANDROID_NDK=${{ env.ANDROID_NDK_HOME }} RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
  61. cd ..
  62. shell: cmd
  63. - name: Generate Artifacts
  64. run: |
  65. cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
  66. cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
  67. cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
  68. cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
  69. cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
  70. cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
  71. cd build
  72. tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
  73. - name: Upload Artifacts
  74. uses: actions/upload-artifact@v3
  75. with:
  76. name: ${{ env.RELEASE_NAME }}.tar.gz
  77. path: ./build/${{ env.RELEASE_NAME }}.tar.gz
  78. - name: Upload Artifact to Release
  79. uses: actions/upload-release-asset@v1.0.1
  80. env:
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. with:
  83. upload_url: ${{ github.event.release.upload_url }}
  84. asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
  85. asset_name: ${{ env.RELEASE_NAME }}.tar.gz
  86. asset_content_type: application/gzip
  87. if: github.event_name == 'release' && github.event.action == 'published'