Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/publish-api-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish API Docs to GitHub Pages
name: Publish API docs and record SDK version

on:
workflow_call:
Expand All @@ -20,6 +20,16 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Validate access to version data service
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok to pin things to this SHA?

Copy link
Copy Markdown
Contributor Author

@priettt priettt Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how it's done everywhere, at least for this particular action. I'm not a fan, but I think it's the only way to make an action immutable. @fnewberg might have additional reasons

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like "current version" should be defined as a variable and be referenced everywhere so we don't have to make N changes when the version revs. Not a blocker - just something to consider.

with:
platform: 'android'
version: ${{ inputs.rc_version }}
dryRun: true
uploadUrl: ${{ vars.SDK_VERSION_URL }}
env:
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}

- name: Configure git
run: |
git config --global user.name 'embrace-ci[bot]'
Expand Down Expand Up @@ -60,3 +70,13 @@ jobs:
git config --global user.email "embrace-ci@users.noreply.github.com"
git commit --allow-empty --message "CI/CD: Automatically generated documentation for ${RC_VERSION}" docs/
git push --force origin gh-pages

- name: Record SDK Version History
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
with:
platform: 'android'
version: ${{ inputs.rc_version }}
dryRun: false
uploadUrl: ${{ vars.SDK_VERSION_URL }}
env:
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish snapshot

env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}

on:
schedule:
- cron: '0 5 * * *' # Runs every day at 5:00 UTC
workflow_dispatch:
inputs:
snapshot_name:
description: 'Name of the snapshot to be published. -SNAPSHOT will be appended automatically, so just add a name. e.g. 7.7.0'
required: false

permissions:
contents: read

jobs:
release:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Set snapshot_name in gradle.properties if set
env:
SNAPSHOT_NAME: ${{ inputs.snapshot_name }}
run: |
if [ -n "$SNAPSHOT_NAME" ]; then
sed -i -r "s#^version=.*#version=${SNAPSHOT_NAME}-SNAPSHOT#" gradle.properties
git add gradle.properties
fi

- name: Fail if version is not -SNAPSHOT
run: |
grep -q -- '-SNAPSHOT$' gradle.properties || (echo "ERROR: version must end with -SNAPSHOT" && exit 1)

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can apply the same Java config to all of our builds, production, snapshot, and otherwise?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a shared workflow, though I'm not sure if it'd work

java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1

- name: Publish to Maven Central
run: |
./gradlew publishToMavenCentral --no-configuration-cache --stacktrace
74 changes: 0 additions & 74 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,74 +0,0 @@
name: Release RC and Update Docs

env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
MAVEN_QA_USER: github
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}

on:
workflow_dispatch:
inputs:
rc_version:
description: 'SDK version this workflow run will release. Specify <major.minor.patch> e.g. 7.1.2. It will use the branch "release/<version>".'
required: true

permissions:
contents: read

jobs:
release-to-maven-central:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Validate access to version data service
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
with:
platform: 'android'
version: ${{ inputs.rc_version }}
dryRun: true
uploadUrl: ${{ vars.SDK_VERSION_URL }}
env:
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}

- name: Checkout SDK
uses: actions/checkout@v4
with:
ref: release/${{ inputs.rc_version }}
fetch-depth: 0
persist-credentials: false

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1

- name: Release to Maven Central
run: |
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --no-build-cache --no-configuration-cache --stacktrace

- name: Record SDK Version History
uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41
with:
platform: 'android'
version: ${{ inputs.rc_version }}
dryRun: false
uploadUrl: ${{ vars.SDK_VERSION_URL }}
env:
SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }}

publish-api-docs:
name: Publish API Docs to GitHub Pages
uses: ./.github/workflows/publish-api-docs.yml
secrets: inherit
permissions:
contents: write
with:
rc_version: ${{ inputs.rc_version }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Upload artifacts to Sonatype
name: Upload artifacts to Maven Central

env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
MAVEN_QA_USER: github
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_ANDROID_GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }}

on:
workflow_call:
Expand All @@ -29,12 +27,6 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Decode Keystore
run: |
mkdir "$RUNNER_TEMP"/keystore
echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg
echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV

- name: Configure git
run: |
git config --global user.name 'embrace-ci[bot]'
Expand All @@ -55,9 +47,9 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1

- name: Publish and close Sonatype repository
- name: Publish to Maven Central
run: |
./gradlew publishAllPublicationsToSonatypeRepository -x embrace-gradle-plugin-integration-tests:publishAllPublicationsToSonatypeRepository closeSonatypeStagingRepository -Dorg.gradle.parallel=false --no-build-cache --no-configuration-cache --stacktrace
./gradlew publishToMavenCentral --no-configuration-cache --stacktrace

- name: Publish git tag
env:
Expand Down
18 changes: 0 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
import java.time.Duration
import org.jetbrains.dokka.gradle.DokkaTaskPartial

plugins {
kotlin("android") apply false
kotlin("jvm") apply false
alias(libs.plugins.google.ksp) apply false
id("com.android.library") apply false
alias(libs.plugins.nexus.publish)
alias(libs.plugins.dokka)
alias(libs.plugins.kover)
}

group = "io.embrace"
version = project.version

nexusPublishing {
repositories {
sonatype {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
}
}
transitionCheckOptions {
maxRetries.set(60)
delayBetween.set(Duration.ofSeconds(20))
}
connectTimeout.set(Duration.ofMinutes(15))
clientTimeout.set(Duration.ofMinutes(15))
}

subprojects {
if (project.name == "embrace-android-sdk" || project.name == "embrace-android-api") {
apply(plugin = "org.jetbrains.dokka")
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation(libs.agp)
implementation(libs.detekt.gradle.plugin)
implementation(libs.binary.compatibility.validator)
implementation(libs.vanniktech.maven.publish)
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import org.gradle.kotlin.dsl.getByType

fun Project.configureProductionModule(
android: LibraryExtension,
module: EmbraceBuildLogicExtension
module: EmbraceBuildLogicExtension,
) {
with(project.pluginManager) {
apply("checkstyle")
apply("org.jetbrains.kotlinx.kover")
apply("maven-publish")
apply("signing")
apply("com.vanniktech.maven.publish")
apply("binary-compatibility-validator")
}

Expand All @@ -37,16 +36,6 @@ fun Project.configureProductionModule(
}
}

publishing {

// create component with single publication variant
// https://developer.android.com/studio/publish-library/configure-pub-variants#single-pub-var
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}

sourceSets {
getByName("test").java.srcDir("src/integrationTest/java")
getByName("test").kotlin.srcDir("src/integrationTest/kotlin")
Expand Down
Loading
Loading