Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support publishing clang-format package #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 31 additions & 0 deletions publish_clang_format.sh
Original file line number Diff line number Diff line change
@@ -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."