Created
March 20, 2018 01:18
-
-
Save kyokomi/8a94c11aa238ce5c7e5a0e5c8b75721e to your computer and use it in GitHub Desktop.
Flutter Android CircleCI2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/android:api-27-alpha | |
environment: | |
- LANG: en_US.UTF-8 | |
- RELEASE_APK_PATH: build/app/outputs/apk/release | |
- RELEASE_APK_NAME: app-release.apk | |
- DEPLOYGATE_USER_NAME: <DeployGate user name> | |
- DEPLOYGATE_API_KEY: <DeployGate API key> | |
- RELEASE_KEY_STORE_ID: <GoogleDriveFileID> | |
- ANDROID_KEYSTORE_ALIAS: <Android app keystore alias name> | |
- ANDROID_KEYSTORE_DIR: ../../ | |
steps: | |
- checkout | |
- run: | |
name: install gdrive and download release.key | |
# https://qiita.com/namakemono/items/c963e75e0af3f7eed732 | |
command: | | |
GDRIVE_FILE_ID=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA | |
GDRIVE_FILE_NAME=gdrive | |
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${GDRIVE_FILE_ID}" > /dev/null | |
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)" | |
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=${GDRIVE_FILE_ID}" -o ${GDRIVE_FILE_NAME} | |
chmod +x ./gdrive | |
./gdrive --refresh-token ${GDRIVE_REFRESH_TOKEN} download ${RELEASE_KEY_STORE_ID} | |
- run: | |
name: Install Flutter SDK | |
command: git clone -b beta https://github.com/flutter/flutter.git ~/flutter | |
- run: | |
name: run tests | |
command: ~/flutter/bin/flutter test | |
- run: | |
name: run build dev | |
command: | | |
~/flutter/bin/flutter build apk --release | |
- store_artifacts: | |
path: build/app/outputs/apk/release/app-release.apk | |
destination: app-release.apk | |
- deploy: | |
name: Deploy to deployGate | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "master" ]; then | |
ls -al ${RELEASE_APK_PATH}/${RELEASE_APK_NAME} | |
curl -F "file=@${RELEASE_APK_PATH}/${RELEASE_APK_NAME}" \ | |
-F "token=${DEPLOYGATE_API_KEY}" \ | |
-F "message=TODO:message" \ | |
https://deploygate.com/api/users/${DEPLOYGATE_USER_NAME}/apps | |
elif [ "${CIRCLE_BRANCH}" == "develop" ]; then | |
ls -al ${RELEASE_APK_PATH}/${RELEASE_APK_NAME} | |
./gradlew :app:uploadDeployGateDebug | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment