Skip to content

Commit 33481c5

Browse files
authored
Prepare branch for releasing 7.6.1 (#2374)
* Migrate to vanniktech maven publish (#2300) * Update publish-api-docs.yml to handle hotfixes * Update upload-artifacts-to-maven-central.yml to accept hotfixes
1 parent 8dd18c0 commit 33481c5

File tree

10 files changed

+157
-313
lines changed

10 files changed

+157
-313
lines changed

.github/workflows/publish-api-docs.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish API Docs to GitHub Pages
1+
name: Publish API docs and record SDK version
22

33
on:
44
workflow_call:
@@ -20,15 +20,33 @@ jobs:
2020
runs-on: ubuntu-latest
2121
timeout-minutes: 60
2222
steps:
23+
- name: Validate access to version data service
24+
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
25+
with:
26+
platform: 'android'
27+
version: ${{ inputs.rc_version }}
28+
dryRun: true
29+
uploadUrl: ${{ vars.SDK_VERSION_URL }}
30+
env:
31+
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}
32+
2333
- name: Configure git
2434
run: |
2535
git config --global user.name 'embrace-ci[bot]'
2636
git config --global user.email 'embrace-ci@users.noreply.github.com'
2737
38+
- name: Extract base version (major.minor.0)
39+
id: base_version
40+
env:
41+
RC_VERSION: ${{ inputs.rc_version }}
42+
run: |
43+
base_version=$(echo "$RC_VERSION" | cut -d. -f1,2).0
44+
echo "base_version=$base_version" >> $GITHUB_OUTPUT
45+
2846
- name: Checkout SDK
2947
uses: actions/checkout@v4
3048
with:
31-
ref: release/${{ inputs.rc_version }}
49+
ref: release/${{ steps.base_version.outputs.base_version }}
3250
fetch-depth: 0
3351

3452
- name: Setup Java
@@ -57,3 +75,13 @@ jobs:
5775
git config --global user.email "embrace-ci@users.noreply.github.com"
5876
git commit --allow-empty --message 'CI/CD: Automatically generated documentation for ${{ inputs.rc_version }}' docs/
5977
git push --force origin gh-pages
78+
79+
- name: Record SDK Version History
80+
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
81+
with:
82+
platform: 'android'
83+
version: ${{ inputs.rc_version }}
84+
dryRun: false
85+
uploadUrl: ${{ vars.SDK_VERSION_URL }}
86+
env:
87+
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish snapshot
2+
3+
env:
4+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USER }}
5+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
6+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
7+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
8+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
9+
10+
on:
11+
schedule:
12+
- cron: '0 5 * * *' # Runs every day at 5:00 UTC
13+
workflow_dispatch:
14+
inputs:
15+
snapshot_name:
16+
description: 'Name of the snapshot to be published. -SNAPSHOT will be appended automatically, so just add a name. e.g. 7.7.0'
17+
required: false
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
release:
24+
timeout-minutes: 60
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Set snapshot_name in gradle.properties if set
28+
env:
29+
SNAPSHOT_NAME: ${{ inputs.snapshot_name }}
30+
run: |
31+
if [ -n "$SNAPSHOT_NAME" ]; then
32+
sed -i -r "s#^version=.*#version=${SNAPSHOT_NAME}-SNAPSHOT#" gradle.properties
33+
git add gradle.properties
34+
fi
35+
36+
- name: Fail if version is not -SNAPSHOT
37+
run: |
38+
grep -q -- '-SNAPSHOT$' gradle.properties || (echo "ERROR: version must end with -SNAPSHOT" && exit 1)
39+
40+
- name: Setup Java
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: 'adopt'
44+
java-version: 17
45+
46+
- name: Setup Gradle
47+
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
48+
49+
- name: Publish to Maven Central
50+
run: |
51+
./gradlew publishToMavenCentral --no-configuration-cache --stacktrace
Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +0,0 @@
1-
name: Release RC and Update Docs
2-
3-
env:
4-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
5-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
6-
MAVEN_QA_USER: github
7-
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
8-
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
9-
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
10-
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
11-
12-
on:
13-
workflow_dispatch:
14-
inputs:
15-
rc_version:
16-
description: 'SDK version this workflow run will release. Specify <major.minor.patch> e.g. 7.1.2. It will use the branch "release/<version>".'
17-
required: true
18-
19-
permissions:
20-
contents: write
21-
22-
jobs:
23-
release-to-maven-central:
24-
runs-on: ubuntu-latest
25-
timeout-minutes: 60
26-
steps:
27-
- name: Validate access to version data service
28-
uses: embrace-io/public-actions/upload-sdk-version@f4229398f257b24dbbe8b873f78e719f9af6cbbb
29-
with:
30-
platform: 'android'
31-
version: ${{ inputs.rc_version }}
32-
dryRun: true
33-
uploadUrl: ${{ vars.SDK_VERSION_URL }}
34-
env:
35-
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}
36-
37-
- name: Checkout SDK
38-
uses: actions/checkout@v4
39-
with:
40-
ref: release/${{ inputs.rc_version }}
41-
fetch-depth: 0
42-
43-
- name: Setup Java
44-
uses: actions/setup-java@v4
45-
with:
46-
distribution: 'adopt'
47-
java-version: 17
48-
49-
- name: Setup Gradle
50-
uses: gradle/actions/setup-gradle@v4
51-
52-
- name: Release to Maven Central
53-
run: |
54-
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --no-build-cache --no-configuration-cache --stacktrace
55-
56-
- name: Record SDK Version History
57-
uses: embrace-io/public-actions/upload-sdk-version@f4229398f257b24dbbe8b873f78e719f9af6cbbb
58-
with:
59-
platform: 'android'
60-
version: ${{ inputs.rc_version }}
61-
dryRun: false
62-
uploadUrl: ${{ vars.SDK_VERSION_URL }}
63-
env:
64-
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}
65-
66-
publish-api-docs:
67-
name: Publish API Docs to GitHub Pages
68-
uses: ./.github/workflows/publish-api-docs.yml
69-
secrets: inherit
70-
with:
71-
rc_version: ${{ inputs.rc_version }}

.github/workflows/upload-artifacts-to-sonatype.yml renamed to .github/workflows/upload-artifacts-to-maven-central.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: Upload artifacts to Sonatype
1+
name: Upload artifacts to Maven Central
22

33
env:
4-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
5-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
6-
MAVEN_QA_USER: github
7-
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
8-
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
9-
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
10-
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
4+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USER }}
5+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
6+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
7+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
8+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
119

1210
on:
1311
workflow_call:
@@ -29,21 +27,24 @@ jobs:
2927
timeout-minutes: 60
3028
runs-on: ubuntu-latest
3129
steps:
32-
- name: Decode Keystore
33-
run: |
34-
mkdir "$RUNNER_TEMP"/keystore
35-
echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg
36-
echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV
37-
3830
- name: Configure git
3931
run: |
4032
git config --global user.name 'embrace-ci[bot]'
4133
git config --global user.email 'embrace-ci@users.noreply.github.com'
4234
35+
- name: Extract base version (major.minor.0)
36+
id: base_version
37+
env:
38+
RC_VERSION: ${{ inputs.rc_version }}
39+
run: |
40+
base_version=$(echo "$RC_VERSION" | cut -d. -f1,2).0
41+
echo "base_version=$base_version" >> $GITHUB_OUTPUT
42+
4343
- name: Checkout
4444
uses: actions/checkout@v4
4545
with:
46-
ref: release/${{ inputs.rc_version }}
46+
ref: release/${{ steps.base_version.outputs.base_version }}
47+
persist-credentials: true
4748

4849
- name: Setup Java
4950
uses: actions/setup-java@v4
@@ -54,9 +55,9 @@ jobs:
5455
- name: Setup Gradle
5556
uses: gradle/actions/setup-gradle@v4
5657

57-
- name: Publish and close Sonatype repository
58+
- name: Publish to Maven Central
5859
run: |
59-
./gradlew publishAllPublicationsToSonatypeRepository -x embrace-gradle-plugin-integration-tests:publishAllPublicationsToSonatypeRepository closeSonatypeStagingRepository -Dorg.gradle.parallel=false --no-build-cache --no-configuration-cache --stacktrace
60+
./gradlew publishToMavenCentral --no-configuration-cache --stacktrace
6061
6162
- name: Publish git tag
6263
run: |

build.gradle.kts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,17 @@
1-
import java.time.Duration
21
import org.jetbrains.dokka.gradle.DokkaTaskPartial
32

43
plugins {
54
kotlin("android") apply false
65
kotlin("jvm") apply false
76
alias(libs.plugins.google.ksp) apply false
87
id("com.android.library") apply false
9-
alias(libs.plugins.nexus.publish)
108
alias(libs.plugins.dokka)
119
alias(libs.plugins.kover)
1210
}
1311

1412
group = "io.embrace"
1513
version = project.version
1614

17-
nexusPublishing {
18-
repositories {
19-
sonatype {
20-
username = System.getenv("SONATYPE_USERNAME")
21-
password = System.getenv("SONATYPE_PASSWORD")
22-
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
23-
}
24-
}
25-
transitionCheckOptions {
26-
maxRetries.set(60)
27-
delayBetween.set(Duration.ofSeconds(20))
28-
}
29-
connectTimeout.set(Duration.ofMinutes(15))
30-
clientTimeout.set(Duration.ofMinutes(15))
31-
}
32-
3315
subprojects {
3416
if (project.name == "embrace-android-sdk" || project.name == "embrace-android-api") {
3517
apply(plugin = "org.jetbrains.dokka")

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies {
1919
implementation(libs.agp)
2020
implementation(libs.detekt.gradle.plugin)
2121
implementation(libs.binary.compatibility.validator)
22+
implementation(libs.vanniktech.maven.publish)
2223
}
2324

2425
gradlePlugin {

buildSrc/src/main/kotlin/io/embrace/internal/ProductionModuleConfig.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ import org.gradle.kotlin.dsl.getByType
77

88
fun Project.configureProductionModule(
99
android: LibraryExtension,
10-
module: EmbraceBuildLogicExtension
10+
module: EmbraceBuildLogicExtension,
1111
) {
1212
with(project.pluginManager) {
1313
apply("checkstyle")
1414
apply("org.jetbrains.kotlinx.kover")
15-
apply("maven-publish")
16-
apply("signing")
15+
apply("com.vanniktech.maven.publish")
1716
apply("binary-compatibility-validator")
1817
}
1918

@@ -37,16 +36,6 @@ fun Project.configureProductionModule(
3736
}
3837
}
3938

40-
publishing {
41-
42-
// create component with single publication variant
43-
// https://developer.android.com/studio/publish-library/configure-pub-variants#single-pub-var
44-
singleVariant("release") {
45-
withSourcesJar()
46-
withJavadocJar()
47-
}
48-
}
49-
5039
sourceSets {
5140
getByName("test").java.srcDir("src/integrationTest/java")
5241
getByName("test").kotlin.srcDir("src/integrationTest/kotlin")

0 commit comments

Comments
 (0)