Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
holi-frontends
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
app
holi-frontends
Commits
5e38fab8
Commit
5e38fab8
authored
1 month ago
by
Ole Langbehn
Browse files
Options
Downloads
Patches
Plain Diff
chore(CI): refactor the mobile build job, allowing for rebuilds of failed builds
parent
ef914328
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci-mobile.yml
+1
-28
1 addition, 28 deletions
.gitlab-ci-mobile.yml
terraform/environments/scripts/build-mobile.sh
+42
-0
42 additions, 0 deletions
terraform/environments/scripts/build-mobile.sh
with
43 additions
and
28 deletions
.gitlab-ci-mobile.yml
+
1
−
28
View file @
5e38fab8
...
...
@@ -37,34 +37,7 @@
cache
:
!reference
[
.yarn-cache-readonly
]
dependencies
:
[]
# explicitly disable artifact usage
script
:
-
'
echo
"Loading
environment
from
\"${ENVIRONMENT_FILE}\""'
-
'
.
${ENVIRONMENT_FILE}'
-
'
cd
apps/mobile'
-
corepack enable
-
yarn install --immutable --immutable-cache
-
eas --version
-
>
if [ "$CHECK_VERSION_RELEASED" == "true" ]; then
export LAST_VERSION_IOS=$(eas build:list --json --non-interactive --platform ios --buildProfile $BUILD_PROFILE --limit=1 2>/dev/null | jq -r '.[0].appBuildVersion')
export LAST_VERSION_ANDROID=$(eas build:list --json --non-interactive --platform android --buildProfile $BUILD_PROFILE --limit=1 2>/dev/null | jq -r '.[0].appBuildVersion')
export CURRENT_VERSION_IOS=$(expo config --json 2>/dev/null | jq -r '.ios.buildNumber')
export CURRENT_VERSION_ANDROID=$(expo config --json 2>/dev/null | jq -r '.android.versionCode')
if [[ "$BUILD_PLATFORM" == "ios" && "$LAST_VERSION_IOS" == "$CURRENT_VERSION_IOS" ]]; then
echo "iOS app version \"$CURRENT_VERSION_IOS\" was already built (and most likely released). Did you forget to increment app versions?"
exit 1
fi
if [[ "$BUILD_PLATFORM" == "android" && "$LAST_VERSION_ANDROID" == "$CURRENT_VERSION_ANDROID" ]]; then
echo "Android app version \"$CURRENT_VERSION_ANDROID\" was already built (and most likely released). Did you forget to increment app versions?"
exit 1
fi
fi
-
'
eas
build
--platform
$BUILD_PLATFORM
--profile
$BUILD_PROFILE
--non-interactive'
-
'
export
ARTIFACT_URL=$(eas
build:list
--gitCommitHash
${CI_COMMIT_SHA}
--json
--non-interactive
--platform
$BUILD_PLATFORM
--limit=1
2>
/dev/null
|
jq
-r
".[0].artifacts.buildUrl")'
# extracts build URL from EAS
-
>
if [ "$KEEP_ARTIFACTS" == "true" ]; then
mkdir -p artifacts_$CI_ARTIFACTS_ENVIRONMENT_NAME
curl -o artifacts_$CI_ARTIFACTS_ENVIRONMENT_NAME/$(basename $ARTIFACT_URL) $ARTIFACT_URL
fi
-
terraform/environments/scripts/build-mobile.sh ./"$ENVIRONMENT_FILE" "$BUILD_PROFILE" "$BUILD_PLATFORM" "$CHECK_VERSION_RELEASED" "$CI_COMMIT_SHA" "$CI_ARTIFACTS_ENVIRONMENT_NAME" "$KEEP_ARTIFACTS"
interruptible
:
true
.mobile_e2e
:
...
...
This diff is collapsed.
Click to expand it.
terraform/environments/scripts/build-mobile.sh
0 → 100755
+
42
−
0
View file @
5e38fab8
#!/usr/bin/env sh
# exit when any command fails
set
-ex
ENVIRONMENT_FILE
=
$1
BUILD_PROFILE
=
$2
BUILD_PLATFORM
=
$3
CHECK_VERSION_RELEASED
=
$4
CI_COMMIT_SHA
=
$5
CI_ARTIFACTS_ENVIRONMENT_NAME
=
$6
KEEP_ARTIFACTS
=
$7
echo
"Loading environment from
\"
${
ENVIRONMENT_FILE
}
\"
"
# shellcheck disable=SC1090
.
"
${
ENVIRONMENT_FILE
}
"
cd
apps/mobile
corepack
enable
yarn
install
--immutable
--immutable-cache
if
[
"
$CHECK_VERSION_RELEASED
"
=
"true"
]
;
then
case
$BUILD_PLATFORM
in
ios
)
VERSION_SELECTOR
=
'.ios.buildNumber'
;;
android
)
VERSION_SELECTOR
=
'.android.versionCode'
;;
*
)
echo
"unknown build platform
$BUILD_PLATFORM
"
;
exit
1
;;
esac
CURRENT_VERSION
=
$(
expo config
--json
2>/dev/null | jq
-r
$VERSION_SELECTOR
)
LAST_STATUS
=
$(
eas build:list
--json
--non-interactive
--platform
"
$BUILD_PLATFORM
"
--buildProfile
"
$BUILD_PROFILE
"
--limit
=
1
--app-version
=
"
$CURRENT_VERSION
"
2>/dev/null | jq
-r
'.[0].status'
)
if
[
"
$LAST_STATUS
"
!=
""
]
&&
[
"
$LAST_STATUS
"
!=
"ERRORED"
]
&&
[
"
$LAST_STATUS
"
!=
"CANCELED"
]
;
then
echo
"
$BUILD_PLATFORM
app version
\"
$CURRENT_VERSION_IOS
\"
is/was already built (status
$LAST_STATUS
). Did you forget to increment app versions?"
exit
1
fi
fi
exit
0
eas build
--platform
"
$BUILD_PLATFORM
"
--profile
"
$BUILD_PROFILE
"
--non-interactive
ARTIFACT_URL
=
$(
eas build:list
--gitCommitHash
"
${
CI_COMMIT_SHA
}
"
--json
--non-interactive
--platform
"
$BUILD_PLATFORM
"
--limit
=
1 2> /dev/null | jq
-r
".[0].artifacts.buildUrl"
)
# extracts build URL from EAS
if
[
"
$KEEP_ARTIFACTS
"
=
"true"
]
;
then
mkdir
-p
artifacts_
"
$CI_ARTIFACTS_ENVIRONMENT_NAME
"
curl
-o
artifacts_
"
$CI_ARTIFACTS_ENVIRONMENT_NAME
"
/
"
$(
basename
"
$ARTIFACT_URL
"
)
"
"
$ARTIFACT_URL
"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment