Как мне сохранить ключевую фразу для Travis CI? (Флаттер выпускает сборку) - PullRequest
0 голосов
/ 28 января 2020

В настоящее время я храню свое хранилище ключей в своем домашнем каталоге и у меня есть файл key.properties с парольной фразой для Flutter (конечно, исключенной из git). Я просто следовал этому руководству .

Я начал экспериментировать с Travis CI / Flutter и получал отладочные сборки при каждом коммите. Я хотел бы, чтобы он делал релизные сборки, но мне нужен способ дать Трэвису и Флаттеру мое хранилище ключей и парольную фразу. Как мне хранить хранилище ключей и парольную фразу? Как передать эти значения Трэвису?

Желательно, чтобы я все еще мог делать сборку релизов на моем P C, но это не обязательно.

Вот мой .travis.yml:

os: linux

# The Ubuntu Trusty release on Travis is known to
# have oraclejdk8 available. For some reason, we couldn't
# get this to work with other distributions/releases.
dist: trusty
jdk: oraclejdk8

# We set language to Node.js (JavaScript) for the sake
# of making creating utility scripts later on easier.
language: node_js
node_js:
  - "12"

env:
  global:
    - ANDROID_SDK_ROOT=/opt/android

sudo: required

addons:
  apt:
    # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
    sources:
      - ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
    packages:
      - lib32stdc++6 # https://github.com/flutter/flutter/issues/6207
      - libstdc++6
      - curl

cache:
  directories:
    - $HOME/.pub-cache
    - node_modules

before_script:
  # Setup gradle.
  - wget https://services.gradle.org/distributions/gradle-4.10.3-bin.zip
  - unzip -qq gradle-4.10.3-bin.zip
  - export GRADLE_HOME=`pwd`/gradle-4.10.3
  - export PATH=$GRADLE_HOME/bin:$PATH

  # (Quick fix: Silence sdkmanager warning)
  - mkdir -p /home/travis/.android
  - echo 'count=0' > /home/travis/.android/repositories.cfg

  # Download and setup Android SDK tools.
  - wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
  - mkdir android-sdk-tools
  - unzip -qq sdk-tools-linux-4333796.zip -d android-sdk-tools
  - export PATH=`pwd`/android-sdk-tools/tools/bin:$PATH
  - mkdir -p $ANDROID_SDK_ROOT

  # This will install the Android SDK 28 using the previously installed SDK tools.
  - yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "tools" "build-tools;29.0.2" "extras;android;m2repository" > /dev/null
  - export PATH=${ANDROID_SDK_ROOT}/tools/bin:$PATH

  # List sdkmanager packages
  # (useful when checking the logs)
  - sdkmanager --list

  # Clone Flutter
  # We clone the Flutter beta branch. You should clone whatever branch
  # you know works for building production apps.
  # If in doubt, you are advised to use the stable branch of Flutter
  # for production apps and you would do this by changing -b beta to -b stable
  # but we started the project before stable existed and whilst beta has always
  # worked reasonably well for us and we find stable is usually too outdated
  # and has too many missing framework features.
  - git clone https://github.com/flutter/flutter.git -b beta --depth 1

  # Add Flutter to the PATH environment variable.
  - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH

script:
  # Prints the flutter version
  # (allows you to ensure, for each build, that Flutter is set up correctly.)
  - flutter doctor -v

  # Run Flutter build
  - ./flutter/bin/flutter build apk --debug --split-per-abi

deploy:
  provider: releases
  # TODO: Encrypt API key: https://docs.travis-ci.com/user/deployment/releases/#authenticating-with-an-oauth-token
  api_key: "API key"
  file:
    - "build/app/outputs/apk/debug/app-armeabi-v7a-debug.apk"
    - "build/app/outputs/apk/debug/app-arm64-v8a-debug.apk"
    - "build/app/outputs/apk/debug/app-x86_64-debug.apk"
  skip_cleanup: true
  draft: true
...