-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into logicErrs
- Loading branch information
Showing
49 changed files
with
2,558 additions
and
1,964 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
This file was deleted.
Oops, something went wrong.
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
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
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,150 @@ | ||
#!/bin/bash | ||
|
||
# Function to bump version number | ||
bump_version() { | ||
local version="$1" | ||
local major minor patch | ||
IFS='.' read -ra ADDR <<< "${version#v}" | ||
major=${ADDR[0]} | ||
minor=${ADDR[1]} | ||
patch=${ADDR[2]} | ||
patch=$((patch + 1)) | ||
echo "v$major.$minor.$patch" | ||
} | ||
|
||
# Function to update version in install/default_config.php | ||
update_default_config_version() { | ||
local new_version="$1" | ||
sed -i -E "s/('WEBCAL_PROGRAM_VERSION' => ')[^']*(')/\1$new_version\2/" install/default_config.php | ||
} | ||
|
||
update_sql_version() { | ||
local file_path="$1" | ||
local new_version="$2" | ||
|
||
# Get the last line of the file | ||
local last_line=$(tail -n 1 "$file_path") | ||
|
||
# Check if the last line contains a version string. | ||
if [[ $last_line == *upgrade* ]]; then | ||
# If it does, replace the version in the last line. | ||
sed -i "$ s/.*/\/\*upgrade_${new_version}\*\//g" "$file_path" | ||
else | ||
# If it doesn't, append a new line with the version. | ||
echo "/*upgrade_${new_version}*/" >> "$file_path" | ||
fi | ||
|
||
echo "Updated $file_path to version $new_version" | ||
} | ||
|
||
|
||
# SQL files to update | ||
declare -a sql_files=( | ||
"install/sql/upgrade-db2.sql" | ||
"install/sql/upgrade-ibase.sql" | ||
"install/sql/upgrade-mssql.sql" | ||
"install/sql/upgrade-mysql.sql" | ||
"install/sql/upgrade-oracle.sql" | ||
"install/sql/upgrade-postgres.sql" | ||
"install/sql/upgrade.sql" | ||
) | ||
|
||
# Function to update version and date in includes/config.php | ||
update_config_php() { | ||
local file_path="includes/config.php" | ||
local new_version="$1" | ||
local new_date=$(date +"%d %b %Y") | ||
|
||
# Update version | ||
sed -i "/^ *\$PROGRAM_VERSION\s*=\s*/s/'[^']*'/'$new_version'/" "$file_path" | ||
|
||
# Update date | ||
sed -i "/^ *\$PROGRAM_DATE =\s*/s/'[^']*'/'$new_date'/" "$file_path" | ||
|
||
echo "Updated $file_path to version $new_version and date $new_date" | ||
} | ||
|
||
|
||
|
||
# Function to update version in .github/workflows/docker.yml | ||
update_docker_yml() { | ||
local file_path=".github/workflows/docker.yml" | ||
local new_version="$1" | ||
|
||
# Get the line number containing the version tag | ||
local line_num=$(grep -nE 'tags: \${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:[^ ]*-dev-php8' "$file_path" | cut -d: -f1) | ||
|
||
# If we found the line, update the version on that line | ||
if [[ -n "$line_num" ]]; then | ||
sed -i "${line_num}s|webcalendar:[^ ]*-dev-php8|webcalendar:${new_version}-dev-php8|" "$file_path" | ||
fi | ||
|
||
echo "Updated $file_path to version $new_version" | ||
} | ||
|
||
# Function to update version in UPGRADING.html | ||
update_upgrading_html() { | ||
local file_path="UPGRADING.html" | ||
local new_version="$1" | ||
local version_without_v="${new_version#v}" # removes 'v' prefix for versions like v1.9.1 | ||
|
||
# Get the line number containing the version | ||
local line_num=$(grep -nE '<th>WebCalendar Version:</th>' "$file_path" | cut -d: -f1) | ||
# Add 1 to the line number to target the next line | ||
((line_num++)) | ||
|
||
# If we found the line, update the version on that line | ||
if [[ -n "$line_num" ]]; then | ||
sed -i "${line_num}s|<td>[^<]*</td>|<td>$version_without_v</td>|" "$file_path" | ||
fi | ||
|
||
echo "Updated $file_path to version $new_version" | ||
} | ||
|
||
# Function to update version in composer.json | ||
update_composer_json() { | ||
local file_path="composer.json" | ||
local new_version="$1" | ||
local version_without_v="${new_version#v}" # removes 'v' prefix for versions like v1.9.1 | ||
|
||
# Use jq to update the version key in the JSON file | ||
jq ".version = \"$version_without_v\"" "$file_path" > "$file_path.tmp" && mv "$file_path.tmp" "$file_path" | ||
|
||
echo "Updated $file_path to version $new_version" | ||
} | ||
|
||
function update_upgrade_matrix() { | ||
local NEW_VERSION="$1" | ||
local file_path="install/sql/upgrade_matrix.php" | ||
|
||
# Using sed to replace the version | ||
sed -i "3s/\$PROGRAM_VERSION = '.*';/\$PROGRAM_VERSION = '$NEW_VERSION';/" "$file_path" | ||
echo "Updated $file_path to version $new_version" | ||
} | ||
|
||
# Main logic | ||
if [ "$#" -eq 0 ]; then | ||
# No arguments provided, bump the version | ||
current_version=$(grep 'WEBCAL_PROGRAM_VERSION' install/default_config.php | sed -E "s/.*'WEBCAL_PROGRAM_VERSION' => '([^']*)'.*/\1/") | ||
new_version=$(bump_version "$current_version") | ||
else | ||
# Argument provided, use it as the new version | ||
new_version="$1" | ||
fi | ||
|
||
update_default_config_version "$new_version" | ||
|
||
for file in "${sql_files[@]}"; do | ||
update_sql_version "$file" "$new_version" | ||
echo "Updated $file to version $new_version" | ||
done | ||
|
||
update_config_php "$new_version" | ||
update_docker_yml "$new_version" | ||
update_upgrading_html "$new_version" | ||
update_composer_json "$new_version" | ||
update_upgrade_matrix "$new_version" | ||
|
||
echo "" | ||
echo "Files updated to version $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
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{ | ||
"name": "k5n/webcalendar", | ||
"type": "project", | ||
"description": "Multi-user web-based calendar app", | ||
"version": "v1.9.1", | ||
"homepage": "https://www.k5n.us/webcalendar/", | ||
"authors": [ | ||
{ | ||
"name": "Craig Knudsen", | ||
"email": "craig@k5n.us", | ||
"homepage": "https://www.k5n.us", | ||
"role": "Project Maintainer / Developer" | ||
} | ||
], | ||
"require": { | ||
"phpmailer/phpmailer": "6.5.4", | ||
"components/jquery": "3.5.*", | ||
"ckeditor/ckeditor": "4.18.*", | ||
"twbs/bootstrap": "4.6.2", | ||
"twbs/bootstrap-icons": "1.8.3", | ||
"phpunit/phpunit": "9.*" | ||
}, | ||
"license": "GPL-2.0-only" | ||
"name": "k5n/webcalendar", | ||
"type": "project", | ||
"description": "Multi-user web-based calendar app", | ||
"version": "1.9.6", | ||
"homepage": "https://www.k5n.us/webcalendar/", | ||
"authors": [ | ||
{ | ||
"name": "Craig Knudsen", | ||
"email": "craig@k5n.us", | ||
"homepage": "https://www.k5n.us", | ||
"role": "Project Maintainer / Developer" | ||
} | ||
], | ||
"require": { | ||
"phpmailer/phpmailer": "6.8.*", | ||
"components/jquery": "3.5.*", | ||
"ckeditor/ckeditor": "4.22.*", | ||
"twbs/bootstrap": "4.6.*", | ||
"twbs/bootstrap-icons": "1.8.*", | ||
"phpunit/phpunit": "9.3" | ||
}, | ||
"license": "GPL-2.0-only" | ||
} |
Oops, something went wrong.