Skip to content

Commit

Permalink
Version 0.0.1-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
handstandsam committed Jun 30, 2024
1 parent 8fb0346 commit 3749366
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 24 deletions.
43 changes: 37 additions & 6 deletions .github/workflows/publish.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish
name: Main Branch

on:
# Runs on pushes targeting the default branch
Expand All @@ -14,7 +14,7 @@ permissions:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "publish"
group: "main"
cancel-in-progress: false

jobs:
Expand All @@ -31,17 +31,18 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
java-version: '17'
check-latest: true

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3


- name: Test on Ubuntu
run: ./gradlew assemble check --no-build-cache --no-daemon --stacktrace

# Deploy to Github Pages
deploy:
github-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down Expand Up @@ -93,21 +94,51 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
java-version: '17'
check-latest: true

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3

- name: Retrieve Version from gradle.properties
run: echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV

- name: Publish Snapshot
run: ./gradlew :invert-models:publish :invert-gradle-plugin:publish --no-configuration-cache --stacktrace
if: success() && endsWith(env.VERSION_NAME, '-SNAPSHOT')
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}


publish-release:
needs:
- test-ubuntu
runs-on: ubuntu-latest
if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
timeout-minutes: 25

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
check-latest: true

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3

- name: Retrieve Version from gradle.properties
run: echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV

- name: Publish release (main only)
run: ./gradlew :invert-models:closeAndReleaseRepository :invert-gradle-plugin:closeAndReleaseRepository --no-configuration-cache --stacktrace
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache --stacktrace
if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT')
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Checks

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Runs on PRs targeting the default branch
pull_request:
branches: ["main"]

Expand Down
16 changes: 8 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ buildscript {
mavenCentral()
google()
gradlePluginPortal()
maven { url = uri("https://oss.sonatype.org/service/local/repositories/snapshots/content") } // SNAPSHOT Versions for statik
maven {
url = uri("https://oss.sonatype.org/service/local/repositories/snapshots/content")
} // SNAPSHOT Versions for statik
}
}

Expand All @@ -16,7 +18,9 @@ allprojects {
mavenCentral()
google()
gradlePluginPortal()
maven { url = uri("https://oss.sonatype.org/service/local/repositories/snapshots/content") } // SNAPSHOT Versions for statik
maven {
url = uri("https://oss.sonatype.org/service/local/repositories/snapshots/content")
} // SNAPSHOT Versions for statik
}
}

Expand All @@ -39,14 +43,10 @@ subprojects
it.afterEvaluate {
val hasPublishPlugin = it.plugins.hasPlugin("com.vanniktech.maven.publish.base")
if (hasPublishPlugin) {
val extension = it.extensions.getByType(MavenPublishBaseExtension::class.java)
extension.apply {
// publishToMavenCentral(SonatypeHost.DEFAULT)
// or when publishing to https://s01.oss.sonatype.org
it.extensions.getByType(MavenPublishBaseExtension::class.java).apply {
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
// or when publishing to https://central.sonatype.com/
signAllPublications()
}
}
}
}
}
2 changes: 1 addition & 1 deletion collectors/collectors-anvil-dagger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
kotlin("jvm")
id("java-gradle-plugin")
kotlin("plugin.serialization")
alias(libs.plugins.vanniktech.maven.publish)
// alias(libs.plugins.vanniktech.maven.publish)
}

java {
Expand Down
2 changes: 1 addition & 1 deletion collectors/collectors-kotlin-java-loc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
kotlin("jvm")
id("java-gradle-plugin")
kotlin("plugin.serialization")
alias(libs.plugins.vanniktech.maven.publish)
// alias(libs.plugins.vanniktech.maven.publish)
}

java {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kotlin.code.style=official
android.useAndroidX=true

group=com.squareup.invert
version=0.0.1-dev-SNAPSHOT
version=0.0.1-dev
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ javax-inject = "1"
kotlin = "2.0.0"
kotlinx-serialization = "1.6.3"
ktor = "2.3.11"
vanniktech-maven-publish = "0.28.0"
vanniktech-maven-publish = "0.29.0"
jetbrains-compose = "1.6.10"
ksp = "1.9.23-1.0.20"
truth = "1.4.2"
Expand Down
20 changes: 19 additions & 1 deletion invert-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.JavadocJar

plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("java-gradle-plugin")
alias(libs.plugins.vanniktech.maven.publish)
}

project.extensions.getByType(MavenPublishBaseExtension::class.java).apply {
configure(
KotlinJvm(
javadocJar = JavadocJar.None(),
// whether to publish a sources jar
sourcesJar = true,
)
)
}

gradlePlugin {
plugins {
this.create("invertPlugin").apply {
Expand Down Expand Up @@ -43,4 +57,8 @@ tasks {
named<Copy>("processResources") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
}

tasks.named("publishMavenPublicationToMavenCentralRepository") {
mustRunAfter("signPluginMavenPublication")
}
14 changes: 13 additions & 1 deletion invert-models/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import com.vanniktech.maven.publish.SonatypeHost
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.JavadocJar

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
alias(libs.plugins.vanniktech.maven.publish)
}

project.extensions.getByType(MavenPublishBaseExtension::class.java).apply {
configure(
KotlinMultiplatform(
javadocJar = JavadocJar.None(),
// whether to publish a sources jar
sourcesJar = true,
)
)
}

kotlin {
js {
browser()
Expand Down
2 changes: 1 addition & 1 deletion owners/owners-github-codeowners/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("jvm")
id("java-gradle-plugin")
alias(libs.plugins.vanniktech.maven.publish)
// alias(libs.plugins.vanniktech.maven.publish)
}

dependencies {
Expand Down

0 comments on commit 3749366

Please sign in to comment.