-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use release-please to hardcode the version in version-updater.sh (#…
…45) This hardcodes (using `x-release-please-version`) the proper version in `./scripts/version-updater.sh`. This also uses `x-release-please-version` for the README and the internal version numbers of the `rockspec`'s - previously this wasn't the case because I thought it might not work.
- Loading branch information
1 parent
462a3f3
commit 6bece94
Showing
7 changed files
with
19 additions
and
42 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
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
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 |
---|---|---|
|
@@ -2,10 +2,7 @@ | |
|
||
set -e | ||
|
||
# This script has two responsibilities: | ||
# 1. Update the package version in the rockspec file. | ||
# 2. Update the actual filename of the rockspec file. | ||
# These two should match. | ||
# This script renames a rockspec file containing one semantic version to another. | ||
# This script doesn't update the rockspec version - the part after the package version, but before the .rockspec | ||
# suffix. That should be done manually if the rockspec itself has changed but not the package contents. | ||
# | ||
|
@@ -21,16 +18,19 @@ input_version=$2 | |
git_username=$3 | ||
git_email=$4 | ||
|
||
if [ "$input_version" == "auto" ]; then | ||
input_version="2.0.0" # { x-release-please-version } | ||
fi | ||
|
||
autocommit='' | ||
if [ -n "$git_username" ] || [ -n "$git_email" ]; then | ||
autocommit=1 | ||
fi | ||
|
||
# Ensure autocommit if provided is | ||
if [ -z "$input_rockspec" ] || [ -z "$input_version" ]; then | ||
echo "Usage: $0 <rockspec package> <new version> [git username] [git email]" | ||
echo "Usage: $0 <rockspec package> <new version|auto> [git username] [git email]" | ||
echo "Example usage locally: $0 launchdarkly-server-sdk 1.2.0" | ||
echo "Example usage in CI: $0 launchdarkly-server-sdk 1.2.0 LaunchDarklyReleaseBot [email protected]" | ||
echo "Example usage in CI: $0 launchdarkly-server-sdk auto LaunchDarklyReleaseBot [email protected]" | ||
echo "Providing a git username and email will automatically commit & push any changes." | ||
exit 1 | ||
fi | ||
|
@@ -68,24 +68,8 @@ for file in "$input_rockspec"-*.rockspec; do | |
new_file_name="$input_rockspec-$input_version-$rockspec_revision.rockspec" | ||
git mv "$file" "$new_file_name" | ||
echo "Renamed $file to $new_file_name" | ||
|
||
# Update the 'version' field with the new semver. | ||
sed -i.bak "s/version = \".*\"/version = \"$input_version-$rockspec_revision\"/" "$new_file_name" | ||
echo "Bumped version from $semver to $input_version" | ||
|
||
# Update the 'tag' field to contain the git tag, which we're hardcoding as 'v' + the version number. This | ||
# relies on the assumption that our release please config specifies a leading v. | ||
sed -i.bak "s/tag = \".*\"/tag = \"v$input_version\"/" "$new_file_name" | ||
echo "Updated source.tag to v$input_version" | ||
|
||
rm -f "$new_file_name.bak" | ||
|
||
# Update README.md to replace $file with the new filename, which will result in the codesample having the new | ||
# version number. | ||
sed -i.bak "s/$file/$new_file_name/" README.md | ||
echo "Updated README.md code example" | ||
rm -f README.md.bak | ||
|
||
if [ "$(git status --porcelain | wc -l)" -gt 0 ]; then | ||
if [ -n "$git_username" ]; then | ||
git config user.name "$git_username" | ||
|
@@ -96,7 +80,7 @@ for file in "$input_rockspec"-*.rockspec; do | |
git add "$new_file_name" | ||
git add README.md | ||
if [ $autocommit ]; then | ||
git commit -m "chore: bump $input_rockspec version from $semver to $input_version and update README" | ||
git commit -m "chore: rename $input_rockspec version from $semver to $input_version" | ||
git push | ||
else | ||
echo "Changes staged, but not committed. Please commit manually." | ||
|