From 03a602d591b86decc2affcbf94b938878710faa2 Mon Sep 17 00:00:00 2001 From: "Alex H." <48185123+Vodes@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:18:13 +0100 Subject: [PATCH] Workaround for atomic-fu --- .github/workflows/auto-publish-snapshot.yml | 29 +++++++++++++++++++ .../configure-publishing.gradle.kts | 10 +++---- build.gradle.kts | 10 +++++++ gradle/libs.versions.toml | 4 +-- 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/auto-publish-snapshot.yml diff --git a/.github/workflows/auto-publish-snapshot.yml b/.github/workflows/auto-publish-snapshot.yml new file mode 100644 index 00000000..4167aba3 --- /dev/null +++ b/.github/workflows/auto-publish-snapshot.yml @@ -0,0 +1,29 @@ +name: "Publish snapshot to styx repo" +on: + push: + +jobs: + build: + runs-on: macos-latest + env: + STYX_REPO_TOKEN: ${{ secrets.STYX_REPO_TOKEN }} + STYX_REPO_SECRET: ${{ secrets.STYX_REPO_SECRET }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: "Setup JDK" + id: setup-java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: gradle + - name: Set commit env variable + run: echo "SNAPSHOT_COMMIT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV + - name: "Build and publish library" + env: + JAVA_HOME: ${{ steps.setup-java.outputs.path }} + run: | + chmod u+x ./gradlew + ./gradlew publishAllPublicationsToStyxRepository -Pversion=$SNAPSHOT_COMMIT -Dorg.gradle.parallel=false --stacktrace --no-configuration-cache \ No newline at end of file diff --git a/build-config/src/main/kotlin/configuration/configure-publishing.gradle.kts b/build-config/src/main/kotlin/configuration/configure-publishing.gradle.kts index c5699af9..435f77d4 100644 --- a/build-config/src/main/kotlin/configuration/configure-publishing.gradle.kts +++ b/build-config/src/main/kotlin/configuration/configure-publishing.gradle.kts @@ -1,5 +1,4 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.SonatypeHost import extensions.isMultiplatformModule import extensions.kotlinMultiplatform @@ -36,10 +35,11 @@ configure { repositories { maven { name = "Styx" - url = if (version.toString().contains("-SNAPSHOT", true)) - uri("https://repo.styx.moe/snapshots") - else - uri("https://repo.styx.moe/releases") + url = + if (version.toString().contains("-SNAPSHOT", true) || !System.getenv("SNAPSHOT_COMMIT").isNullOrBlank()) + uri("https://repo.styx.moe/snapshots") + else + uri("https://repo.styx.moe/releases") credentials { username = System.getenv("STYX_REPO_TOKEN") password = System.getenv("STYX_REPO_SECRET") diff --git a/build.gradle.kts b/build.gradle.kts index 46cfb021..436c19c4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,4 +31,14 @@ apiValidation { } } +allprojects { + configurations.all { + resolutionStrategy.eachDependency { + if (requested.group == "org.jetbrains.kotlinx" && requested.name == "atomicfu") { + useVersion("0.23.2") + } + } + } +} + fun MutableSet.add(dependency: DelegatingProjectDependency) = add(dependency.name) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 28027014..f6615cb6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] agp = "8.7.2" -kotlin = "2.1.0" +kotlin = "2.0.21" mavenPublish = "0.30.0" composeMultiplatform = "1.7.1" binaryCompatibilityValidator = "0.16.3" -atomicfu = "0.26.1" +atomicfu = "0.23.2" ktlint = "12.1.2" coroutines = "1.9.0"