我正在使用Circle CI通过Firebase App Distribution实现APK分发,并且我有一个工作流程包含2个工作,一个工作构建APK,第二个工作将其部署在Firebase App Distribution上。
version: 2.1
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx2g
GRADLE_OPTS: '-Dkotlin.compiler.execution.strategy="in-process"'
steps:
- checkout
- run:
name: Create keystore.jks
command: echo $RELEASE_KEY_BASE64 | base64 --decode > $RELEASE_KEY_STORE
- run:
name: Create keystore.properties
command: printf 'releaseKeyAlias=%s\nreleaseKeyPassword=%s\nreleaseKeyStore=%s\nreleaseStorePassword=%s' $RELEASE_KEY_ALIAS $RELEASE_KEY_PASSWORD $RELEASE_KEY_STORE $RELEASE_KEY_PASSWORD > keystore.properties
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew lint test
- run:
name: Run UnitTest
command: ./gradlew test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
- run:
name: Initial build
command: ./gradlew clean assembleRelease --no-daemon --stacktrace
- store_artifacts:
path: app/build/outputs/apk/
destination: apks/
deploy:
docker:
- image: circleci/ruby:2.4-node
working_directory: ~/code
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run:
name: Install Firebase CLI
command: curl -sL https://firebase.tools | bash
- run:
name: Distribute APK to Firebase
command: firebase appdistribution:distribute "/home/circleci/code/app/build/outputs/apk/release/app-release.apk" --app $FIREBASE_APP_ID --token $FIREBASE_TOKEN --release-notes "Test Release Note" --groups $FIREBASE_TEST_GROUP --debug
workflows:
version: 2.0
build-deploy:
jobs:
- build:
- deploy:
requires:
- build
当我访问在构建作业中生成的部署作业中的APK时,出现以下错误。 错误:文件/home/circleci/code/app/build/outputs/apk/release/app-release.apk不存在:请验证文件是否指向发行版。
但是相同的代码可以在单个作业中工作。 有什么方法可以使文件访问另一个作业?