File tree Expand file tree Collapse file tree 4 files changed +56
-9
lines changed
build-logic/src/main/java/com/squareup/workflow1/buildsrc Expand file tree Collapse file tree 4 files changed +56
-9
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish Release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+
6
+ jobs :
7
+ publish-release :
8
+ runs-on : ubuntu-latest
9
+ if : github.repository == 'square/workflow-kotlin'
10
+ timeout-minutes : 35
11
+
12
+ steps :
13
+ - uses : actions/checkout@v3
14
+ - uses : gradle/wrapper-validation-action@v1
15
+
16
+ - name : Ensure this isn't a -SNAPSHOT version
17
+ uses : ./.github/actions/gradle-task
18
+ with :
19
+ task : checkVersionIsNotSnapshot
20
+
21
+ - name : Assemble
22
+ uses : ./.github/actions/gradle-task
23
+ with :
24
+ task : assemble
25
+
26
+ - name : Check
27
+ uses : ./.github/actions/gradle-task
28
+ with :
29
+ task : check -x artifactsCheck
30
+
31
+ - name : Publish Release
32
+ uses : ./.github/actions/gradle-task
33
+ with :
34
+ task : publish
35
+ env :
36
+ ORG_GRADLE_PROJECT_mavenCentralUsername : ${{ secrets.SONATYPE_NEXUS_USERNAME }}
37
+ ORG_GRADLE_PROJECT_mavenCentralPassword : ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
38
+ ORG_GRADLE_PROJECT_signingInMemoryKey : ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
Original file line number Diff line number Diff line change 6
6
branches :
7
7
- main
8
8
9
- env :
10
- GRADLE_OPTS : " -Dorg.gradle.jvmargs=-Xmx12g -Dorg.gradle.daemon=false -Dorg.gradle.logging.stacktrace=all"
11
-
12
9
jobs :
13
10
publish-snapshot :
14
11
runs-on : workflow-kotlin-test-runner-ubuntu-4core
Original file line number Diff line number Diff line change 30
30
git tag v0.1.0
31
31
```
32
32
33
- 1 . Upload the kotlin artifacts :
33
+ 1 . Push those changes to the repository :
34
34
``` bash
35
- ./gradlew clean && ./gradlew build && ./gradlew publish
35
+ git push
36
36
```
37
37
38
- 1 . Close and release the staging repository at https://s01.oss.sonatype.org/#stagingRepositories .
38
+ 1 . Run the ` Publish Release ` action in the [ GitHub Actions ] ( https://github.com/square/workflow-kotlin/actions/workflows/publish-release.yml ) page by clicking "run workflow" on the right .
39
39
40
- 1 . Bump the version
40
+ 1 . Wait for that publishing job to succeed.
41
+
42
+ 1 . Back on your local machine, bump the version
41
43
- ** Kotlin:** Update the ` VERSION_NAME ` property in ` gradle.properties ` to the new
42
44
snapshot version, e.g. ` VERSION_NAME=0.2.0-SNAPSHOT ` .
43
45
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import org.gradle.api.publish.maven.MavenPublication
13
13
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
14
14
15
15
class PublishingConventionPlugin : Plugin <Project > {
16
-
17
16
override fun apply (target : Project ) {
18
17
target.plugins.apply (" org.jetbrains.dokka" )
19
18
target.plugins.apply (" com.vanniktech.maven.publish.base" )
@@ -37,8 +36,19 @@ class PublishingConventionPlugin : Plugin<Project> {
37
36
}
38
37
}
39
38
39
+ target.tasks.register(" checkVersionIsNotSnapshot" ) { task ->
40
+ task.group = " publishing"
41
+ task.description = " ensures that the project version does not have a -SNAPSHOT suffix"
42
+ val versionString = target.version as String
43
+ task.doLast {
44
+ require(! versionString.endsWith(" -SNAPSHOT" )) {
45
+ " The project's version name cannot have a -SNAPSHOT suffix, but it was $versionString ."
46
+ }
47
+ }
48
+ }
49
+
40
50
target.extensions.configure(MavenPublishBaseExtension ::class .java) { basePluginExtension ->
41
- basePluginExtension.publishToMavenCentral(SonatypeHost .S01 )
51
+ basePluginExtension.publishToMavenCentral(SonatypeHost .S01 , automaticRelease = true )
42
52
// Will only apply to non snapshot builds.
43
53
basePluginExtension.signAllPublications()
44
54
// import all settings from root project and project-specific gradle.properties files
You can’t perform that action at this time.
0 commit comments