I2S-4MBFlash.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. # This is a basic workflow to help you get started with Actions
  2. name: I2S-4MFlash
  3. on:
  4. push:
  5. branches: [ master-cmake ]
  6. pull_request:
  7. branches: [ master-cmake ]
  8. jobs:
  9. job1:
  10. name: Build Number
  11. runs-on: ubuntu-latest
  12. outputs:
  13. build_number: ${{ steps.buildnumber.outputs.build_number }}
  14. steps:
  15. - name: Generate common build number
  16. id: buildnumber
  17. uses: einaregilsson/build-number@v2
  18. with:
  19. token: ${{secrets.github_token}}
  20. build:
  21. runs-on: ubuntu-latest
  22. needs: job1
  23. strategy:
  24. matrix:
  25. node: [I2S-4MFlash, ESP32-A1S, SqueezeAmp]
  26. steps:
  27. - name: Set target name
  28. run: |
  29. echo "TARGET_BUILD_NAME=${{ matrix.node }}" >> $GITHUB_ENV
  30. echo "build_version_prefix=V0." >> $GITHUB_ENV
  31. - uses: actions/checkout@v2
  32. with:
  33. submodules: true
  34. - name: Cache build
  35. id: cache-build
  36. uses: actions/cache@v1
  37. with:
  38. path: ${{github.RUNNER_WORKSPACE}}/build
  39. key: ${{ runner.os }}-${TARGET_BUILD_NAME}
  40. - name: Set build parameters
  41. run: |
  42. shopt -s nocasematch
  43. branch_name="${GITHUB_REF//refs\/heads\//}"
  44. branch_name="${branch_name//[^a-zA-Z0-9\-~!@_\.]/}"
  45. BUILD_NUMBER=${{ needs.job1.outputs.build_number }}
  46. echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
  47. tag="${build_version_prefix}${BUILD_NUMBER}-${TARGET_BUILD_NAME}-${branch_name}"
  48. last_commit="$(git log --pretty=format:'%s' --max-count=1)"
  49. if [[ "$last_commit" =~ .*"Release".* ]]; then echo "release_flag=1" >> $GITHUB_ENV; else echo "release_flag=0" >> $GITHUB_ENV; fi
  50. name="${build_version_prefix}${BUILD_NUMBER}.${branch_name}#v4.0#${TARGET_BUILD_NAME}#${branch_name}"
  51. artifact_prefix="squeezelite-esp32-${branch_name}-${TARGET_BUILD_NAME}-${build_version_prefix}${BUILD_NUMBER}"
  52. artifact_file_name="${artifact_prefix}.zip"
  53. artifact_bin_file_name="${artifact_prefix}.bin"
  54. echo "name=${name}" >> $GITHUB_ENV
  55. echo "last_commit=${last_commit}" >> $GITHUB_ENV
  56. echo "artifact_file_name=${artifact_file_name}" >> $GITHUB_ENV
  57. echo "artifact_bin_file_name=${artifact_bin_file_name}" >> $GITHUB_ENV
  58. description=""
  59. description=${description}$'------------------------------\n### Revision Log\n\n'
  60. description="$description$(git log --pretty=format:'%h %s (%cI) <%an>' --abbrev-commit --max-count=15 | sed --r 's/(^[\*]+)/\\\1/g') "
  61. echo ${description}
  62. echo ${description} >>release_desc.txt
  63. echo "description=${description}" >> $GITHUB_ENV
  64. cat release_desc.txt
  65. - name: Show Target
  66. run: |
  67. echo "Target is ${TARGET_BUILD_NAME}"
  68. env
  69. - name: Build the firmware
  70. if: env.release_flag == 1 && env.release_flag == 0
  71. run: |
  72. docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build && zip ${artifact_file_name} ../partitions*.csv *.bin ./bootloader/bootloader.bin ./partition_table/partition-table.bin flash_project_args ./size_*.txt"
  73. - name: Build Mock firmware
  74. run: |
  75. mkdir -p build
  76. cd build
  77. mkdir -p partition_table
  78. mkdir -p bootloader
  79. echo "mock content"> squeezelite.bin
  80. echo "mock content"> recovery.bin
  81. echo "mock content"> ./bootloader/bootloader.bin
  82. echo "mock content"> ./partition_table/partition-table.bin
  83. echo "mock content"> flash_project_args
  84. echo "mock content"> size_comp1.txt
  85. echo "mock content"> size_comp2.txt
  86. echo "mock content"> ../partitions.csv
  87. - uses: actions/upload-artifact@v2
  88. with:
  89. name: ${{ env.artifact_file_name }}
  90. path: |
  91. build/*.bin
  92. build/bootloader/bootloader.bin
  93. build/partition_table/partition-table.bin
  94. build/flash_project_args
  95. build/size_comp1.txt
  96. build/size_comp2.txt
  97. partitions.csv
  98. - uses: actions/upload-artifact@v2
  99. with:
  100. name: ${{ env.artifact_bin_file_name }}
  101. path: |
  102. build/squeezelite.bin
  103. - name: Create Release
  104. if: env.release_flag == 1
  105. id: create_release
  106. uses: actions/create-release@v1
  107. env:
  108. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
  109. with:
  110. tag_name: ${{ env.tag }}
  111. release_name: ${{ env.name }}
  112. body: ${{ env.description }}
  113. draft: false
  114. prerelease: true
  115. - name: Prepare release
  116. if: env.release_flag == 1
  117. run: |
  118. description=""
  119. description=${description}$'------------------------------\n### Revision Log\n\n'
  120. description="$description$(git -C ${RUNNER_WORKSPACE} log --pretty=format:'%h %s (%cI) <%an>' --abbrev-commit --max-count=15 | sed --r 's/(^[\*]+)/\\\1/g') "