forked from steampixel/RadentscheidWordpressLocations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist.sh
33 lines (26 loc) · 949 Bytes
/
dist.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Read in version number
read -p "Enter the new package version: " version
echo The new version is $version
# Promt for confirmation
read -p "Is that correct? (Type Y) " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
# Replace the version numbers
sed -i "5s/.*/* Version: $version/" sp-locations.php
sed -i "10s/.*/define('SP_LOCATIONS_VERSION', '$version');/" sp-locations.php
# Create new archive
# Move out of the plugin folder. So we can add the parent folder to the archive too
cd ..
7za a -tzip ./sp-locations/dist/sp-locations_$version.zip sp-locations/ -mx0 -xr!.git -xr!dist -xr!dist.sh
cd sp-locations
# Add the changes to git
git add sp-locations.php
git add dist
# Commit
git commit -m "Moved to version $version"
# Tag
git tag $version master
git push --follow-tags