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 Jul 1, 2024
1 parent 8fb0346 commit 790da48
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 25 deletions.
44 changes: 38 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,52 @@ 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:
# Temporary to help debug publishing of 0.0.1-dev
# 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 publishToMavenCentral --no-configuration-cache --stacktrace --no-parallel
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
64 changes: 56 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import com.vanniktech.maven.publish.GradlePlugin
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

Expand All @@ -7,7 +12,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 +23,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 +48,53 @@ 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()
pom {
url.set("https://www.github.com/square/invert")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
scm {
url.set("https://www.github.com/square/invert")
connection.set("scm:git:git://github.com/square/invert.git")
developerConnection.set("scm:git:ssh://[email protected]/square/invert.git")
}
developers {
developer {
name.set("Block, Inc.")
url.set("https://github.com/square")
}
}
}
if (plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
configure(
KotlinJvm(
javadocJar = JavadocJar.None(),
sourcesJar = true,
)
)
}
if (plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
configure(
KotlinMultiplatform(
javadocJar = JavadocJar.None(),
sourcesJar = true,
)
)
}
// configure(
// GradlePlugin(
// javadocJar = JavadocJar.None(),
// sourcesJar = true,
// )
// )
}
}
}
}
}
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
11 changes: 10 additions & 1 deletion invert-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ plugins {
alias(libs.plugins.vanniktech.maven.publish)
}

afterEvaluate {
tasks.named("publishMavenPublicationToMavenCentralRepository") {
mustRunAfter(tasks.named("signPluginMavenPublication"))
}
tasks.named("publishPluginMavenPublicationToMavenCentralRepository") {
mustRunAfter(tasks.named("signMavenPublication"))
}
}

gradlePlugin {
plugins {
this.create("invertPlugin").apply {
Expand Down Expand Up @@ -43,4 +52,4 @@ tasks {
named<Copy>("processResources") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
}
2 changes: 0 additions & 2 deletions invert-models/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
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 790da48

Please sign in to comment.