diff --git a/.github/workflows/cipd.yml b/.github/workflows/cipd.yml index d8cca79..6f9b186 100644 --- a/.github/workflows/cipd.yml +++ b/.github/workflows/cipd.yml @@ -11,6 +11,9 @@ on: description: 'the target cipd ensure file(s), split by comma. (e.g. gn.ensure)' required: true type: string + custom_script: + description: 'use the custom script after downloading cipd package by ensure files' + type: string jobs: download: @@ -35,6 +38,11 @@ jobs: - name: generate sha256 list run: python3 publish_helper.py --sha256-list + - name: run custom script + if: ${{ github.event.inputs.custom_script }} + run: | + bash ${{ github.event.inputs.custom_script }} + - name: push to release uses: ncipollo/release-action@v1 with: diff --git a/publish_clang_format.sh b/publish_clang_format.sh new file mode 100644 index 0000000..5cffd91 --- /dev/null +++ b/publish_clang_format.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# This script is used to extract clang-format executable file from llvm package + +root_dir=$PWD + +# clear the hash.md +cat /dev/null > hash.md + +# Traverse all tar.gz under llvm directory +for file in buildtools-*.tar.gz;do + # llvm files already exists + raw_folder=$(echo $file | sed 's/.tar.gz//g') + + # extract the clang-format file + clang_format_dir=$(echo $raw_folder | sed 's/llvm/clang-format/g') + mkdir $clang_format_dir + subdir=$(echo $file | awk -F"-" '{print $(NF-1)"-"$NF}') + cp $root_dir/buildtools/llvm/$subdir/bin/clang-format $clang_format_dir/ + + # package the artifacts + tar -czf $clang_format_dir.tar.gz $clang_format_dir + + # get the hash of file and write in hash.md + hash=$(openssl dgst -sha256 "$clang_format_dir.tar.gz" | awk '{print $2}') + echo "$clang_format_dir.tar.gz: $hash" - >> hash.md + + # delete llvm packages + rm -rf $file +done + +echo "Extraction and archiving completed." \ No newline at end of file