-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.sh
executable file
·48 lines (35 loc) · 1.01 KB
/
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
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
version=$1
force=$2
package=$(basename $(pwd))
output_dir=/tmp/$package-$version
PRIVATE_KEY=/home/felix/.$package.pem
if [[ ! $version ]]; then
echo "Needs a version number as argument"
exit 1
fi
echo "Releasing version ${version}"
echo "Setting version number in manifest.json"
sed -i "s/version\":.*/version\": \"${version}\"/" manifest.json
if [[ $(git diff | grep manifest.json) ]]; then
echo "Committing changes"
git add manifest.json
git commit -m"Releasing version $version"
fi
echo "Tagging locally"
git tag $force $version
echo "Pushing tag"
git push --tags origin master
echo "Creating directory"
rm -rf $output_dir
mkdir $output_dir
echo "Archiving"
git archive $version | tar -x -C $output_dir
echo "Packing for github upload"
google-chrome --pack-extension=$output_dir --pack-extension-key=$PRIVATE_KEY
echo "Copying private key"
cp $PRIVATE_KEY $output_dir/key.pem
echo "Creating zip file for webstore upload"
rm -f $output_dir.zip
zip -r $output_dir.zip $output_dir