Skip to content

Commit 080aa0a

Browse files
committed
Lint with shellcheck
1 parent fb273fd commit 080aa0a

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

cibuild

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22

33
set -e
44

5-
export SCRIPT_DIR=`dirname $0`
5+
SCRIPT_DIR=$(dirname "$0")
6+
export SCRIPT_DIR
67

78
# Includes
8-
. $SCRIPT_DIR/update_build_number
9-
. $SCRIPT_DIR/update_version
10-
. $SCRIPT_DIR/update_keychain
9+
. "$SCRIPT_DIR/update_build_number"
10+
. "$SCRIPT_DIR/update_version"
11+
. "$SCRIPT_DIR/update_keychain"
1112

12-
GIT_COMMIT=`git rev-parse --short HEAD`
13-
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
14-
GIT_TAG=`git describe --tags --exact-match --match "v*" 2>/dev/null || echo ""`
15-
GIT_DIRTY=`test -n "$(git status --porcelain)" && echo true || echo false`
16-
GIT_LOG=`git log -1 --pretty=format:%s`
13+
GIT_COMMIT=$(git rev-parse --short HEAD)
14+
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
15+
GIT_TAG=$(git describe --GIT_TAGs --exact-match --match "v*" 2>/dev/null || echo "")
16+
GIT_DIRTY=$(test -n "$(git status --porcelain)" && echo true || echo false)
17+
GIT_LOG=$(git log -1 --pretty=format:%s)
18+
export GIT_COMMIT GIT_BRANCH GIT_TAG GIT_DIRTY GIT_LOG
19+
20+
BUILD=
21+
VERSION=
22+
export BUILD VERSION
1723

1824
silent=0
1925

@@ -33,32 +39,31 @@ say ()
3339
if [ "$CI_SERVER_NAME" = "GitLab CI" ];
3440
then
3541
say "GitLab CI detected."
36-
branch=$CI_BUILD_REF_NAME
37-
build=$CI_BUILD_ID
38-
commit=$CI_BUILD_REF
39-
tag=${GIT_TAG:1}
42+
GIT_BRANCH=$CI_BUILD_REF_NAME
43+
GIT_COMMIT=$CI_BUILD_REF
44+
VERSION=${GIT_TAG:1}
45+
BUILD=$CI_BUILD_ID
4046
fi
4147

4248
import_certs
4349
import_provisions
4450

45-
if [ -n "$tag" ];
51+
if [ -n "$GIT_TAG" ];
4652
then
47-
say "Preparing for Beta Release $tag"
53+
say "Preparing for Beta Release $GIT_TAG"
4854

49-
update_build_number $build
50-
update_version $tag
55+
update_build_number "$BUILD"
56+
update_version "$VERSION"
5157

5258
make release-beta
5359

54-
elif [ "$branch" = "master" ];
60+
elif [ "$GIT_BRANCH" = "master" ];
5561
then
5662
say "Preparing for Alpha Release"
5763

58-
update_build_number $build
64+
update_build_number "$BUILD"
5965

6066
make release-alpha
61-
ipa build -c Alpha
6267

6368
else
6469
say "Preparing for Development Release"

update_build_number

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22

3-
update_build_number ()
4-
{
3+
update_build_number() {
54
local build=$1
65

76
if ! echo "$build" | grep -q -E '^[0-9]+$'
@@ -10,7 +9,7 @@ update_build_number ()
109
exit 1
1110
fi
1211

13-
xcrun agvtool new-version -all $build
12+
xcrun agvtool new-version -all "$build"
1413
}
1514

1615
export -f update_build_number

update_keychain

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
# The name of the keychain to create for iOS code signing.
24
KEYCHAIN=ck-ios-build.keychain
35

@@ -12,7 +14,7 @@ import_certs ()
1214

1315
if security show-keychain-info "$KEYCHAIN" >/dev/null 2>&1
1416
then
15-
echo "warnning: $KEYCHIAN already exist, force removed"
17+
echo "warnning: $KEYCHAIN already exist, force removed"
1618
security delete-keychain "$KEYCHAIN"
1719
fi
1820

@@ -50,7 +52,7 @@ import_provisions ()
5052
fi
5153

5254
local p
53-
for p in $(ls $SCRIPT_DIR/provisions/*.mobileprovision);
55+
for p in $SCRIPT_DIR/provisions/*.mobileprovision;
5456
do
5557
cp "$p" "$HOME/Library/MobileDevice/Provisioning Profiles/"
5658
echo "${p##*/} imported"
@@ -72,9 +74,9 @@ delete_provisions ()
7274
fi
7375

7476
local p
75-
for p in $(ls $SCRIPT_DIR/provisions);
77+
for p in $SCRIPT_DIR/provisions;
7678
do
77-
rm "$HOME/Library/MobileDevice/Provisioning Profiles/$p"
79+
rm "$HOME/Library/MobileDevice/Provisioning Profiles/${p##*/}"
7880
done
7981
}
8082

update_version

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22

3-
update_version ()
4-
{
3+
update_version() {
54
local version=$1
65

76
if ! echo "$version" | grep -q -E '^[0-9]+(\.[0-9]+){2}$'
@@ -10,7 +9,7 @@ update_version ()
109
exit 1
1110
fi
1211

13-
xcrun agvtool new-marketing-version $version
12+
xcrun agvtool new-marketing-version "$version"
1413
}
1514

1615
export -f update_version

0 commit comments

Comments
 (0)