-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: improve bash script for release #2396
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
export DEPLOY_BRANCH=${DEPLOY_BRANCH:-development} | ||
export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master} | ||
[[ $TRAVIS_REPO_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_FOSS_SLUG=true || IS_FOSS_SLUG=false | ||
[[ $TRAVIS_PULL_REQUEST_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_FOSS_PR=true || IS_FOSS_PR=false | ||
[[ $TRAVIS_BRANCH =~ ^(development|master)$ && $IS_FOSS_SLUG ]] && BRANCH_DEPLOYORDEV=true || BRANCH_DEPLOYORDEV=false | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-attendee-android" ] || ! [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" -o "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous code is more readable, modify yours like this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great, let me try to break the conditions down |
||
[[ $TRAVIS_BRANCH =~ ^(master)$ && $IS_FOSS_SLUG ]] && IS_PUBLISH_BRANCH=true || IS_PUBLISH_BRANCH=false | ||
|
||
[[ $TRAVIS_PULL_REQUEST =~ ^(false)$ && $BRANCH_DEPLOYORDEV ]] && export DEV_OR_MASTER_BUILD=${DEV_OR_MASTER_BUILD:-true} || export DEV_OR_MASTER_BUILD=${DEV_OR_MASTER_BUILD:-false} | ||
|
||
[[ $IS_PUBLISH_BRANCH && $IS_FOSS_PR =~ ^(true)$ ]] && export PR_FOR_RELEASE=${PR_FOR_RELEASE:-true} || export PR_FOR_RELEASE=${PR_FOR_RELEASE:-false} | ||
|
||
if ! ( $DEV_OR_MASTER_BUILD || $PR_FOR_RELEASE ); then | ||
echo "We decrypt key only for pushes to the master branch and not PRs. So, skip." | ||
exit 0 | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,24 @@ set -e | |
git config --global user.name "Travis CI" | ||
git config --global user.email "noreply+travis@fossasia.org" | ||
|
||
[[ $TRAVIS_BRANCH =~ ^(master)$ && $TRAVIS_REPO_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_PUBLISH_BRANCH=true || IS_PUBLISH_BRANCH=false | ||
[[ $TRAVIS_BRANCH =~ ^(development)$ && $TRAVIS_REPO_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_DEV_BRANCH=true || IS_DEV_BRANCH=false | ||
[[ $TRAVIS_PULL_REQUEST =~ ^(false)$ && $TRAVIS_REPO_SLUG =~ ^(fossasia/open-event-attendee-android)$ && $TRAVIS_BRANCH =~ ^(development|master)$ ]] && DEV_OR_MASTER_BUILD=true || DEV_OR_MASTER_BUILD=false | ||
[[ $IS_PUBLISH_BRANCH && $TRAVIS_PULL_REQUEST_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && PR_FOR_RELEASE=true || PR_FOR_RELEASE=false | ||
[[ $TRAVIS_REPO_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_FOSS_SLUG=true || IS_FOSS_SLUG=false | ||
[[ $TRAVIS_PULL_REQUEST_SLUG =~ ^(fossasia/open-event-attendee-android)$ ]] && IS_FOSS_PR=true || IS_FOSS_PR=false | ||
[[ $TRAVIS_BRANCH =~ ^(development|master)$ && $IS_FOSS_SLUG ]] && BRANCH_DEPLOYORDEV=true || BRANCH_DEPLOYORDEV=false | ||
|
||
[[ $TRAVIS_BRANCH =~ ^(master)$ && $IS_FOSS_SLUG ]] && IS_PUBLISH_BRANCH=true || IS_PUBLISH_BRANCH=false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, conditional assignments don't work like this in bash. This was my first thought as well, but unfortunately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will see |
||
[[ $TRAVIS_BRANCH =~ ^(development)$ && $IS_FOSS_SLUG ]] && IS_DEV_BRANCH=true || IS_DEV_BRANCH=false | ||
|
||
[[ $TRAVIS_PULL_REQUEST =~ ^(false)$ && $BRANCH_DEPLOYORDEV ]] && export DEV_OR_MASTER_BUILD=${DEV_OR_MASTER_BUILD:-true} || export DEV_OR_MASTER_BUILD=${DEV_OR_MASTER_BUILD:-false} | ||
|
||
[[ $IS_PUBLISH_BRANCH && $IS_FOSS_PR =~ ^(true)$ ]] && export PR_FOR_RELEASE=${PR_FOR_RELEASE:-true} || export PR_FOR_RELEASE=${PR_FOR_RELEASE:-false} | ||
|
||
if $PR_FOR_RELEASE; then | ||
FASTLANE_DRY_RUN="--validate_only true" | ||
fi | ||
|
||
if ! ( $DEV_OR_MASTER_BUILD || $PR_FOR_RELEASE ); then | ||
echo "We upload apk only for changes in development or master, and not PRs. So, let's skip this shall we ? :)" | ||
exit 0 | ||
exit 0 | ||
fi | ||
|
||
./gradlew bundlePlayStoreRelease | ||
|
@@ -57,6 +63,9 @@ if $IS_PUBLISH_BRANCH ;then | |
cd .. | ||
gem install fastlane | ||
fastlane supply --aab ./apk/eventyay-attendee-master-app-playStore-release.aab --skip_upload_apk true --track alpha --json_key ./scripts/fastlane.json --package_name $PACKAGE_NAME $FASTLANE_DRY_RUN | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
if $PR_FOR_RELEASE ;then | ||
exit 0 | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this. We can override this from environment variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok let me add export to the conditions