forked from wilson212/bf2stats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement (ci): Add
release.sh
to create releases
- Loading branch information
1 parent
e6f9f31
commit c926c96
Showing
2 changed files
with
30 additions
and
6 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,28 @@ | ||
#!/bin/sh | ||
# This script makes it easy to create a new release. | ||
# It requires git, which is only used to detect the previous tag. | ||
|
||
set -eu | ||
|
||
TAG=${1:-} | ||
if [ -z "$TAG" ]; then | ||
echo "Please specify a tag as a first argument." | ||
exit 1 | ||
fi | ||
TAG_REGEX='^[0-9]+\.[0-9]+\.[0-9]+$' | ||
if ! echo "$TAG" | grep -E "$TAG_REGEX" > /dev/null; then | ||
echo "Tag does not match regex: $TAG_REGEX" | ||
exit 1 | ||
fi | ||
TAG_PREV=$( git --no-pager tag -l --sort=-version:refname | head -n1 ) | ||
if ! echo "$TAG_PREV" | grep -E "$TAG_REGEX" > /dev/null; then | ||
echo "Previous git tag is invalid. It does not match regex: $TAG_REGEX" | ||
exit 1 | ||
fi | ||
|
||
# Update version in docs, .php, and .sql files | ||
git ls-files | grep -E '(^docker-compose.yml|^README.md|^docs/|index.php|bf2statistics.php|BF2StatisticsConfig.py)' | while read -r l; do | ||
sed -i "s/$TAG_PREV/$TAG/g" "$l" | ||
done | ||
|
||
echo "Done bumping version to $TAG in all files. The release comment has been added in src/ASP/system/sql/migrations/migrations.php" |