-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# Do NOT exit on error | ||
set +e | ||
|
||
# Create Sodium dir | ||
mkdir -p "$WORKSPACE/libs/sodium" | ||
cd "$WORKSPACE/libs/sodium" | ||
|
||
# Clone the repository | ||
git clone https://github.com/jedisct1/libsodium.git . | ||
git fetch --tags | ||
|
||
# Export the latest tag | ||
SODIUM_VERSION="$(git describe --tags $(git rev-list --tags --max-count=1))" | ||
echo "SODIUM_VERSION=$SODIUM_VERSION" >> $GITHUB_ENV | ||
|
||
# Checkout the latest tag | ||
git checkout "$SODIUM_VERSION" | ||
|
||
# Build the library | ||
$COMMAND | ||
EXPORT_DIR="$WORKSPACE/libs/libsodium/$RID/native/" | ||
|
||
# Check if the output file has changed, since sometimes Git struggles on Windows | ||
cmp --silent "$OUTPUT_FILE" "$EXPORT_DIR/$FILE" | ||
if [ $? -eq 0 ]; then | ||
echo 'No changes detected' | ||
exit 0 | ||
fi | ||
|
||
# Move the output file to the correct location | ||
mkdir -p "$EXPORT_DIR" | ||
rm -f "$EXPORT_DIR/$FILE" | ||
mv "$OUTPUT_FILE" "$EXPORT_DIR/$FILE" | ||
|
||
# Delay committing to prevent race conditions | ||
sleep "$(( '${{ strategy.job-index }}' * 2 ))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters