Skip to content

Commit f2d7f4a

Browse files
author
lightningd
committed
feat(ci): configure maven publish job
1 parent 5e009ad commit f2d7f4a

3 files changed

Lines changed: 56 additions & 3 deletions

File tree

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ variables:
44

55
stages:
66
- build
7+
- deploy
78

89
default:
910
image: ${CI_IMAGE}:${CI_IMAGE_VER} # set in CI env vars

gitlab/deploy-maven.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# maven credentials and gpg settings
2+
# in runner's ~/.gradle/gradle.properties
3+
publish_to_maven:
4+
stage: deploy
5+
tags:
6+
- m4
7+
rules:
8+
- if: "$CI_COMMIT_TAG"
9+
when: manual
10+
needs: []
11+
script:
12+
- cd libs/gl-sdk-android
13+
- ./gradlew publish --no-daemon
14+
artifacts:
15+
paths:
16+
- libs/gl-sdk-android/lib/build/libs
17+
- libs/gl-sdk-android/lib/build/outputs
18+
- libs/gl-sdk-android/lib/build/publications
19+
when: always
20+
expire_in: 7 days
21+
allow_failure: true
22+
23+
publish_snapshot_to_maven:
24+
stage: deploy
25+
tags:
26+
- m4
27+
needs: []
28+
rules:
29+
- if: '$CI_COMMIT_BRANCH == "main"'
30+
when: on_success
31+
script:
32+
- cd libs/gl-sdk-android
33+
- RAW_VERSION=$(grep '^libraryVersion=' gradle.properties | cut -d'=' -f2)
34+
- BASE_VERSION=${RAW_VERSION%-SNAPSHOT}
35+
- VERSION_CORE=$(echo "$BASE_VERSION" | sed -E 's/[^0-9.].*$//')
36+
- IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_CORE"
37+
- MAJOR=${MAJOR:-0}
38+
- MINOR=${MINOR:-0}
39+
- PATCH=${PATCH:-0}
40+
- NEXT_PATCH=$((PATCH + 1))
41+
- NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
42+
- SNAPSHOT_VERSION="${NEXT_VERSION}-SNAPSHOT"
43+
- echo "Publishing snapshot version ${SNAPSHOT_VERSION} (base=${BASE_VERSION})"
44+
- ./gradlew -PlibraryVersion=${SNAPSHOT_VERSION} publish --no-daemon
45+
artifacts:
46+
paths:
47+
- libs/gl-sdk-android/lib/build/libs
48+
- libs/gl-sdk-android/lib/build/outputs
49+
- libs/gl-sdk-android/lib/build/publications
50+
when: always
51+
expire_in: 7 days
52+
allow_failure: true

libs/gl-sdk-android/lib/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ mavenPublishing {
136136
}
137137
}
138138

139-
//publishToMavenCentral()
140-
//signAllPublications()
139+
publishToMavenCentral()
140+
signAllPublications()
141141
}
142142

143143
extensions.configure<SigningExtension> {
@@ -152,4 +152,4 @@ tasks.withType<Sign>().configureEach {
152152
// Skip signing if the build is targeting the local Maven repository
153153
taskNames.none { it.contains("publishToMavenLocal", ignoreCase = true) || it.contains("publishToLocalMaven", ignoreCase = true) }
154154
}
155-
}
155+
}

0 commit comments

Comments
 (0)