-
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.
- Loading branch information
1 parent
45adff2
commit de1af7e
Showing
4 changed files
with
52 additions
and
0 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 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 | ||
|
||
# Ask the user for the new version number | ||
read -p "Enter the new version: " new_version | ||
|
||
# Check if the new version is provided | ||
if [[ -z "$new_version" ]]; then | ||
echo "You must provide a new version!" | ||
exit 1 | ||
fi | ||
|
||
echo "v$new_version" >.github/.version | ||
|
||
# Define the files to update | ||
files_to_update=("composer.json" "package.json" "style.css") | ||
|
||
# Loop through the files and update the version | ||
for file in "${files_to_update[@]}"; do | ||
if [[ -f "$file" ]]; then | ||
if [[ "$file" == "style.css" ]]; then | ||
sed -i '' -E "s/(Version: )[0-9]+\.[0-9]+\.[0-9]+/\1$new_version/" "$file" | ||
else | ||
sed -i '' -E "s/(\"version\": \")[0-9]+\.[0-9]+\.[0-9]+\"/\1$new_version\"/" "$file" | ||
fi | ||
else | ||
echo "Warning: File $file does not exist and was not updated." | ||
fi | ||
done | ||
|
||
# Commit the changes with the provided message | ||
git add "${files_to_update[@]}" | ||
git commit -m "chore(🚀): bump project version" | ||
|
||
echo "Version updated to $new_version and committed to git." |
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,15 @@ | ||
#!/bin/bash | ||
|
||
# Fetch the latest tags from the remote repository | ||
git fetch --tags | ||
|
||
# Get the latest version from the .version file | ||
new_version=$(<.github/.version) | ||
|
||
# Get the latest tag before the new version | ||
previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1)) | ||
|
||
# Generate the release notes content | ||
echo "**CHANGELOG:**" >.github/.release-notes | ||
echo "" >>.github/.release-notes | ||
echo "- https://github.com/somoscuatro/sc-starter-theme/compare/${previous_tag}...${new_version}" >>.github/.release-notes |
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