Closed ArcherEmiya05 closed 2 years ago
Yes: https://github.com/Triple-T/gradle-play-publisher#uploading-a-pre-existing-artifact
Thanks a lot, one more question does ./gradlew :app:publishReleaseBundle
command generates AAB file to the build folder? Cause we want to use that AAB that GPP task created for other task as well.
We want to achieve something like this ./gradlew :app:publishReleaseBundle :app:uploadAabRelease
.
Where :app:publishReleaseBundle
will generate release AAB file and publish it in internal track then :app:uploadAabRelease
task reuses the cached results from this task and doesn't need run everything again.
Publish just depends on the bundle task from AGP (don't remember what it's called). https://github.com/Triple-T/gradle-play-publisher/blob/4273731c8126cdbf071300882718ec2ae12f3e3c/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt#L464 You'll want to use the variant.artifacts.get(...)
part.
Thanks a lot!
Publish just depends on the bundle task from AGP (don't remember what it's called).
https://github.com/Triple-T/gradle-play-publisher/blob/4273731c8126cdbf071300882718ec2ae12f3e3c/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt#L464 You'll want to use the
variant.artifacts.get(...)
part.
I just want to follow up, does ./gradlew :app:publishReleaseBundle
command uses :app:assembleRelease
internally?
No because that's a human task. There's an underlying task the AGP API gives us which does the actual building. If you want to use a named task, you can probably just depend on bundleRelease
. (assembleRelease
is for APKs)
No because that's a human task. There's an underlying task the AGP API gives us which does the actual building. If you want to use a named task, you can probably just depend on
bundleRelease
. (assembleRelease
is for APKs)
Is this the equivalent of ./gradlew :app:publishReleaseBundle
in a more manual approach?
build.gradle
play {
serviceAccountCredentials.set(file(PLAY_API_KEY_FILE))
artifactDir.set(file("app/build/outputs/bundle/release"))
}
Gradle command
./gradlew clean :app:bundleRelease :app:publishBundle
Is the artifact dir here is enough or we should also explicitly add the file name app-release.aab
in it?
Oh, you need to run those in two separate builds or muck around with the task dependencies. If you use artifactDir, publishBundle
will run immediately (without waiting for bundleRelease to finish).
Oh, you need to run those in two separate builds or muck around with the task dependencies. If you use artifactDir,
publishBundle
will run immediately (without waiting for bundleRelease to finish).
You mean separate task?
./gradlew clean :app:bundleRelease
// Keep the build artifacts for subsequent pipeline steps
./gradlew clean :app:publishBundle
Don't run clean: ./gradlew :app:publishBundle
Don't run clean:
./gradlew :app:publishBundle
My bad
Hi, just want to raise this issue again. I actually tried this
First step
Build Bundle (Release)
...
./gradlew clean :app:bundleRelease"
artifacts: # Keep these artifacts for subsequent pipeline steps
- app/build/outputs/** # Artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/
Second step
Deploy to PlayStore (Internal)
...
"./gradlew :app:publishBundle"
But it does not work, the task is successful but no bundle was uploaded to the store.
Artifacts from previous pipeline build was downloaded so I am pretty sure it not empty
Do I need to include the actual AAB file name in this path?
artifactDir.set(file("app/build/outputs/bundle/release"))
Like this
artifactDir.set(file("app/build/outputs/bundle/release/app-release.aab"))
No, that shouldn't be necessary. I would add an ls -R
step to see what files are present.
No, that shouldn't be necessary. I would add an
ls -R
step to see what files are present.
Shouldn't we supposed to start at build folder like this? artifactDir.set(file("build/outputs/bundle/release"))
since build.gradle
is inside the app module already?
I tried to download the artifact and its directory is this app\build\outputs\bundle\release
Oh yeah, you're right. artifactDir.set(file("build/outputs/bundle/release"))
should work.
Oh yeah, you're right.
artifactDir.set(file("build/outputs/bundle/release"))
should work.
Thanks will try this
No, that shouldn't be necessary. I would add an
ls -R
step to see what files are present.Shouldn't we supposed to start at build folder like this?
artifactDir.set(file("build/outputs/bundle/release"))
sincebuild.gradle
is inside the app module already?
Solved, closing the issue now.
This command
./gradlew :app:publishReleaseBundle
builds aab and release it to internal track. But what if we wanted to reuse the generated aab file for other purposes? Can we instead build aab file with gradle and provide it to GPP in the command to save build minute for CI CD? Thanks