Skip to content

Commit

Permalink
build: update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Aug 6, 2024
1 parent 3ff4cd9 commit cfdc7d4
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .build-and-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,35 @@ echo "────────────────────────"
# GUARD
if [[ -z "$nextVersion" || "$nextVersion" == "$currentVersion" ]]; then
print "\033[1;31mInvalid version number.\033[0m"
exit 1
return 1
fi

# update version number in THE REPO'S `info.plist`
plutil -replace version -string "$nextVersion" info.plist

#───────────────────────────────────────────────────────────────────────────────
# INFO
# this section assumes the local folder is named the same as the github repo
# INFO this assumes the local folder is named the same as the github repo
# 1. update version number in LOCAL `info.plist`
# 2. convenience: copy download link for current version

# update version number in LOCAL `info.plist`
prefs_location=$(grep "current" "$HOME/Library/Application Support/Alfred/prefs.json" | cut -d'"' -f4 | sed -e 's|\\/|/|g' -e "s|^~|$HOME|")
workflow_name="$(basename "$PWD")"
localInfoPlist="$prefs_location/workflows/$workflow_name/info.plist"
[[ -f "$localInfoPlist" ]] && plutil -replace version -string "$nextVersion" "$localInfoPlist"
local_info_plist="$prefs_location/workflows/$workflow_name/info.plist"
[[ -f "$local_info_plist" ]] && plutil -replace version -string "$nextVersion" "$local_info_plist"

# convenience: copy download link for current version
github_username="chrisgrieser"
echo -n "https://github.com/$github_username/$workflow_name/releases/download/$nextVersion/${workflow_name}.alfredworkflow" |
pbcopy
# copy download link for current version
msg="Available in the Alfred Gallery in 1-2 days, or directly by downloading the latest release here:"
github_user=$(git remote --verbose | head -n1 | sed -E 's/.*github.com[:\](.*)\/.*/\1/')
url="https://github.com/$github_user/$workflow_name/releases/download/$nextVersion/${workflow_name}.alfredworkflow"
echo -n "$msg $url" | pbcopy

#───────────────────────────────────────────────────────────────────────────────
# commit and push
# (pushing a tag triggers the github release action)

# commit and push
git add --all &&
git commit -m "release: $nextVersion" &&
git pull &&
git push &&
git tag "$nextVersion" &&
git push origin --tags
git pull --no-progress &&
git push --no-progress &&
git tag "$nextVersion" && # pushing a tag triggers the github release action
git push --no-progress origin --tags

0 comments on commit cfdc7d4

Please sign in to comment.