Skip to content

Instantly share code, notes, and snippets.

@kyokomi
Created March 20, 2018 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyokomi/8a94c11aa238ce5c7e5a0e5c8b75721e to your computer and use it in GitHub Desktop.
Save kyokomi/8a94c11aa238ce5c7e5a0e5c8b75721e to your computer and use it in GitHub Desktop.
Flutter Android CircleCI2.0
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