2022-10-28 05:55:41 +00:00
|
|
|
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
name: reuse binaries of the latest release if no more modification on the_path since last_commit
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
binary_name_stem:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
last_commit:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
the_path:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
upload_url:
|
|
|
|
description: upload binary assets to the URL of release
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
outputs:
|
|
|
|
result:
|
|
|
|
value: ${{ jobs.build.outputs.result }}
|
|
|
|
|
2024-10-22 01:13:55 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-10-28 05:55:41 +00:00
|
|
|
jobs:
|
|
|
|
reuse:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
result: ${{ steps.try_reuse.outputs.result }}
|
2024-10-22 01:13:55 +00:00
|
|
|
permissions:
|
|
|
|
contents: write # for creating realease and uploading release artifacts
|
|
|
|
|
2022-10-28 05:55:41 +00:00
|
|
|
steps:
|
2024-01-26 23:55:49 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-10-28 05:55:41 +00:00
|
|
|
# Full git history is needed to get a proper list of commits and tags
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: try to reuse binaries
|
|
|
|
id: try_reuse
|
|
|
|
run: |
|
|
|
|
echo '::echo::on'
|
|
|
|
python3 ./.github/scripts/reuse_latest_release_binaries.py \
|
|
|
|
--binary_name_stem ${{ inputs.binary_name_stem }} \
|
|
|
|
--last_commit ${{ inputs.last_commit }} \
|
|
|
|
--the_path ${{ inputs.the_path }} .
|
|
|
|
ls -lh .
|
|
|
|
|
|
|
|
- run: echo ${{ steps.try_reuse.outputs.result }}
|
|
|
|
|
|
|
|
- name: upload release tar.gz
|
|
|
|
if: steps.try_reuse.outputs.result == 'hit'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ inputs.upload_url }}
|
|
|
|
asset_path: ${{ inputs.binary_name_stem }}.tar.gz
|
|
|
|
asset_name: ${{ inputs.binary_name_stem }}.tar.gz
|
|
|
|
asset_content_type: application/x-gzip
|
|
|
|
|
|
|
|
- name: upload release zip
|
|
|
|
if: steps.try_reuse.outputs.result == 'hit'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ inputs.upload_url }}
|
|
|
|
asset_path: ${{ inputs.binary_name_stem }}.zip
|
|
|
|
asset_name: ${{ inputs.binary_name_stem }}.zip
|
|
|
|
asset_content_type: application/zip
|