forked from spamwax/alfred-pinboard-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_alfred_workflow.sh
executable file
·63 lines (48 loc) · 1.61 KB
/
create_alfred_workflow.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# set -x
version_tag=$1
msg=$2
push_it=$3
if [ -z "$version_tag" ]; then
echo "You need to provide a semver tag: v0.9.10"
exit
fi
alfred_pinboard_rs="/Volumes/Home/hamid/src/learn/rust/alfred-pinboard-rs"
workflow_dir="$HOME/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.665EAB20-5141-463D-8C5A-90093EEAA756"
res_dir="$alfred_pinboard_rs/res/workflow"
git checkout master || exit
echo "Building new release..."
cd "$alfred_pinboard_rs" || exit
# fix cargo version
cp Cargo.toml Cargo.toml.back
python res/fix_cargo_version.py "$version_tag"
cargo build --release > build.log 2>&1
echo "Copying resoursces from Alfred's workflow dir..."
cp "$workflow_dir"/* "$res_dir"
echo "Copying executable to workflow's folder..."
strip target/release/alfred-pinboard-rs
cp target/release/alfred-pinboard-rs "$res_dir"
echo "Updating version in info.plist"
# version_tag=$(git describe --tags --abbrev=0)
defaults write "$res_dir"/info.plist version "$version_tag"
plutil -convert xml1 "$res_dir"/info.plist
cp "$res_dir"/info.plist "$workflow_dir"
echo "Creating the workflow bundle..."
rm -f AlfredPinboardRust.alfredworkflow
cd "$res_dir" || exit
rm -f AlfredPinboardRust.alfredworkflow
zip -r AlfredPinboardRust.alfredworkflow ./*
echo "Moving bundle to executable folder..."
mv AlfredPinboardRust.alfredworkflow "$alfred_pinboard_rs"
rm alfred-pinboard-rs
commit_msg="Release version $version_tag"
[ ! -z "$msg" ] && commit_msg="$commit_msg
$msg"
git pull origin master
git commit -a -m "$commit_msg"
git tag "$version_tag"
if [ ! -z "$push_it" ]; then
git push
sleep 5
git push --tags
fi