Skip to content

Commit 5929559

Browse files
committed
perf: setup actions provide default version tags when git fails
1 parent a36f24c commit 5929559

File tree

23 files changed

+1770
-92
lines changed

23 files changed

+1770
-92
lines changed

boost-clone/dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

boost-clone/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# Description: Build all the javascript projects in the repository
22

3+
#!/bin/bash
4+
5+
# Function to fetch tags from a Git repository and save them as a JSON array
6+
fetch_tags() {
7+
local repo_url=$1
8+
local output_file=$2
9+
10+
# Check if git is installed
11+
if ! command -v git &> /dev/null; then
12+
echo "fetch_tags(${repo_url}): Error: git is not installed."
13+
return 1
14+
fi
15+
16+
# Check if jq is installed
17+
if ! command -v jq &> /dev/null; then
18+
echo "fetch_tags(${repo_url}): Error: jq is not installed."
19+
return 1
20+
fi
21+
22+
# Create the output directory if it doesn't exist
23+
mkdir -p "$(dirname "$output_file")"
24+
25+
# Fetch tags using git ls-remote and format them as a JSON array
26+
git ls-remote --tags "$repo_url" | awk '{print $2}' | sed 's|refs/tags/||' | jq -R . | jq -s . > "$output_file"
27+
28+
if [ $? -ne 0 ]; then
29+
echo "Error: Failed to fetch or process tags from the repository: $repo_url"
30+
exit 1
31+
fi
32+
33+
echo "Tags have been saved to $output_file."
34+
}
35+
36+
# Fetch default tags for tools whose versions we need to know
37+
fetch_tags "git://gcc.gnu.org/git/gcc.git" "setup-program/gcc-tags.json"
38+
fetch_tags "https://github.com/llvm/llvm-project" "setup-program/clang-tags.json"
39+
fetch_tags "https://github.com/Kitware/CMake.git" "setup-program/cmake-tags.json"
40+
341
projects_with_package=()
442
projects_with_action=()
543

cmake-workflow/dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake-workflow/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp-matrix/dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp-matrix/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-install/dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-install/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup-clang/dist/index.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)