-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI for building and releasing index files
- Loading branch information
1 parent
7eabb82
commit aa79777
Showing
4 changed files
with
80 additions
and
4 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 @@ | ||
0.0.1 |
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,34 @@ | ||
#!/bin/bash | ||
|
||
# File containing the version | ||
TAG_FILE=".github/release-tag.txt" | ||
|
||
# Read the current version from the file | ||
if [ ! -f "$TAG_FILE" ]; then | ||
echo "File with tag does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Read the version from the file | ||
read -r current_version < "$TAG_FILE" | ||
|
||
# Break the version number into its components | ||
IFS='.' read -r major minor patch <<< "$current_version" | ||
|
||
# Ensure that the version number is valid | ||
if ! [[ $major =~ ^[0-9]+$ && $minor =~ ^[0-9]+$ && $patch =~ ^[0-9]+$ ]]; then | ||
echo "Error: Version number '$current_version' is not in a valid MAJOR.MINOR.PATCH format." | ||
exit 1 | ||
fi | ||
|
||
# Increment the patch version | ||
patch=$((patch + 1)) | ||
|
||
# Assemble the new version number | ||
new_version="${major}.${minor}.${patch}" | ||
|
||
# Write the new version back to the file | ||
echo "$new_version" > "$TAG_FILE" | ||
|
||
# Return the new version | ||
echo "$new_version" |
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,33 @@ | ||
#!/bin/bash | ||
|
||
# Check for proper number of command line args. | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 path_to_json.xz new_url" | ||
exit 1 | ||
fi | ||
|
||
# Assign command line args to variables | ||
input_file="$1" | ||
new_url="$2" | ||
temp_json="temp.json" | ||
|
||
# Decompress the .xz file into a temporary JSON file | ||
xz -d -k -c "${input_file}" > "${temp_json}" | ||
|
||
# Check if jq is installed | ||
if ! command -v jq &> /dev/null | ||
then | ||
echo "jq could not be found, please install jq to use this script." | ||
exit 1 | ||
fi | ||
|
||
# Update the URL field using jq | ||
jq --arg new_url "$new_url" '.entries[0].url = $new_url' "${temp_json}" > "${temp_json}.tmp" && mv "${temp_json}.tmp" "${temp_json}" | ||
|
||
# Compress the modified JSON file back into the .xz format | ||
xz -z -c "${temp_json}" > "${input_file}" | ||
|
||
# Remove the temporary JSON file | ||
rm "${temp_json}" | ||
|
||
echo "The url field has been updated to $new_url and the file ${input_file} is modified" |
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