forked from rime/squirrel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-before-deploy.sh
executable file
·40 lines (36 loc) · 1.21 KB
/
travis-before-deploy.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
#!/bin/bash
cd "$(dirname $0)"
source package/common.sh
app_version="$(get_app_version)"
version_name="${app_version}"
if [[ -n "${TRAVIS_TAG}" ]]
then
package_name='release'
version_name="${TRAVIS_TAG}"
version_desc="鼠鬚管 ${version_name}"
publish=false
sed "{
s/{{package_name}}/${package_name}/g
s/{{version_name}}/${version_name}/g
s/{{version_desc}}/${version_desc}/g
s/{{publish}}/${publish}/g
}" travis-deploy-package.json.template > travis-deploy-package-release.json
else
package_name='testing'
git_hash="$(git rev-parse HEAD | cut -c -7)"
version_name="${app_version}+git${git_hash}"
version_desc="鼠鬚管測試版 ${version_name}"
publish=true
sed "{
s/{{package_name}}/${package_name}/g
s/{{version_name}}/${version_name}/g
s/{{version_desc}}/${version_desc}/g
s/{{publish}}/${publish}/g
}" travis-deploy-package.json.template > travis-deploy-package-testing.json
fi
built_archive="package/archives/Squirrel-${app_version}.zip"
upload_archive="package/archives/Squirrel-${version_name}.zip"
if [[ "${built_archive}" != "${upload_archive}" ]]
then
mv "${built_archive}" "${upload_archive}"
fi