generated from chrisgrieser/alfred-workflow-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.build-and-release.sh
executable file
·39 lines (31 loc) · 1.75 KB
/
.build-and-release.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
34
35
36
37
38
39
#!/bin/zsh
# BUILD AND RELEASE
#───────────────────────────────────────────────────────────────────────────────
# goto git root
cd "$(git rev-parse --show-toplevel)" || return 1
# Prompt for next version number
currentVersion=$(plutil -extract version xml1 -o - info.plist | sed -n 's/.*<string>\(.*\)<\/string>.*/\1/p')
echo "current version: $currentVersion"
echo -n " next version: "
read -r nextVersion
echo "────────────────────────"
# update version number in *repo* info.plist
plutil -replace version -string "$nextVersion" info.plist
# #───────────────────────────────────────────────────────────────────────────────
#
# INFO specific to my setup: update version number in *local* info.plist
localInfoPlist="$HOME/.config/Alfred.alfredpreferences/workflows/$(basename "$PWD")/info.plist"
if [[ -f "$localInfoPlist" ]]; then
plutil -replace version -string "$nextVersion" "$localInfoPlist"
fi
# convenience: copy new version number (e.g. for closed bug reports)
echo -n "$nextVersion" | pbcopy
#───────────────────────────────────────────────────────────────────────────────
# git operations
git add -A
git commit -m "release: $nextVersion"
git pull
git push
# trigger the release action via github action
git tag "$nextVersion"
git push origin --tags