Skip to content

Commit

Permalink
support publishing clang-format package
Browse files Browse the repository at this point in the history
  • Loading branch information
scanf3 committed Dec 9, 2024
1 parent 3f3d933 commit b4105e8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/cipd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
34 changes: 34 additions & 0 deletions publish_clang_format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/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
# unzip the llvm package
raw_folder=$(echo $file | sed 's/.tar.gz//g')

mkdir $root_dir/$raw_folder
tar -zxvf "$root_dir/$file" -C "$root_dir/$raw_folder/"


# extract the clang-format file
clang_format_dir=$(echo $raw_folder | sed 's/llvm/clang-format/g')
mkdir $clang_format_dir
cp $root_dir/$raw_folder/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."

0 comments on commit b4105e8

Please sign in to comment.