reuse_latest_release_binaries.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: reuse binaries of the latest release if no more modification on the_path since last_commit
  4. on:
  5. workflow_call:
  6. inputs:
  7. binary_name_stem:
  8. type: string
  9. required: true
  10. last_commit:
  11. type: string
  12. required: true
  13. the_path:
  14. type: string
  15. required: true
  16. upload_url:
  17. description: upload binary assets to the URL of release
  18. type: string
  19. required: true
  20. outputs:
  21. result:
  22. value: ${{ jobs.build.outputs.result }}
  23. jobs:
  24. reuse:
  25. runs-on: ubuntu-latest
  26. outputs:
  27. result: ${{ steps.try_reuse.outputs.result }}
  28. steps:
  29. - uses: actions/checkout@v3
  30. # Full git history is needed to get a proper list of commits and tags
  31. with:
  32. fetch-depth: 0
  33. - name: try to reuse binaries
  34. id: try_reuse
  35. run: |
  36. echo '::echo::on'
  37. python3 ./.github/scripts/reuse_latest_release_binaries.py \
  38. --binary_name_stem ${{ inputs.binary_name_stem }} \
  39. --last_commit ${{ inputs.last_commit }} \
  40. --the_path ${{ inputs.the_path }} .
  41. ls -lh .
  42. - run: echo ${{ steps.try_reuse.outputs.result }}
  43. - name: upload release tar.gz
  44. if: steps.try_reuse.outputs.result == 'hit'
  45. uses: actions/upload-release-asset@v1
  46. env:
  47. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  48. with:
  49. upload_url: ${{ inputs.upload_url }}
  50. asset_path: ${{ inputs.binary_name_stem }}.tar.gz
  51. asset_name: ${{ inputs.binary_name_stem }}.tar.gz
  52. asset_content_type: application/x-gzip
  53. - name: upload release zip
  54. if: steps.try_reuse.outputs.result == 'hit'
  55. uses: actions/upload-release-asset@v1
  56. env:
  57. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  58. with:
  59. upload_url: ${{ inputs.upload_url }}
  60. asset_path: ${{ inputs.binary_name_stem }}.zip
  61. asset_name: ${{ inputs.binary_name_stem }}.zip
  62. asset_content_type: application/zip