Skip to content

Commit 70e4a31

Browse files
Build distribution zip files & upload to Zeus (#979)
1 parent 10621bf commit 70e4a31

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@ allprojects {
5656
}
5757
}
5858

59+
subprojects {
60+
if (!this.name.contains("sample") && this.name != "sentry-test-support") {
61+
apply<DistributionPlugin>()
62+
63+
configure<DistributionContainer> {
64+
this.getByName("main").contents {
65+
// non android modules
66+
from("build/libs")
67+
from("build/publications/maven")
68+
// android modules
69+
from("build/outputs/aar")
70+
from("build/publications/release")
71+
}
72+
}
73+
tasks.named("distZip").configure {
74+
this.dependsOn("publishToMavenLocal")
75+
this.doLast {
76+
val distributionFilePath = "${this.project.buildDir}/distributions/${this.project.name}-${this.project.version}.zip"
77+
val file = File(distributionFilePath)
78+
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
79+
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
80+
}
81+
}
82+
}
83+
}
84+
5985
spotless {
6086
lineEndings = LineEnding.UNIX
6187
java {

scripts/zeus.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
# Redirect stderr to stdout to avoid weird Powershell errors
3+
exec 2>&1
4+
set -x
5+
6+
export PATH=./node_modules/.bin:$PATH
7+
8+
upload_artifacts() {
9+
zeus upload -t "application/x-java-archive" ./*/build/distributions/*.zip
10+
zeus job update --status=passed
11+
}
12+
13+
14+
report_pending() {
15+
zeus job update --status=pending
16+
}
17+
18+
19+
report_failed() {
20+
zeus job update --status=failed
21+
}
22+
23+
24+
check_branch() {
25+
# Ignore errors if not on release branch
26+
if [[ ! "${APPVEYOR_REPO_BRANCH:-}" =~ ^main/ ]]; then
27+
trap - EXIT
28+
echo "Not on a release branch, ignoring all errors, if any."
29+
exit 0
30+
fi
31+
}
32+
33+
trap check_branch EXIT
34+
35+
command="${1:-}"
36+
if [[ "$command" == "upload_artifacts" ]]; then
37+
upload_artifacts
38+
elif [[ "$command" == "report_pending" ]]; then
39+
report_pending
40+
elif [[ "$command" == "report_failed" ]]; then
41+
report_failed
42+
else
43+
echo "Invalid command"
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)