Skip to content

Commit

Permalink
Improve the release flow (#18)
Browse files Browse the repository at this point in the history
* Introduce the gradle-release plugin

* Add RELEASE_OPERATIONS.md
  • Loading branch information
nakamura-to committed Sep 12, 2020
1 parent 2b1a31c commit d98d0d7
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 370 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ jobs:
java-version: 1.8

- name: Grant execute permission for codegen/gradlew
working-directory: ./codegen
run: chmod +x gradlew

- name: Grant execute permission for codegen-test/gradlew
working-directory: ./codegen-test
run: chmod +x gradlew

- name: Build plugin
working-directory: ./codegen
run: ./gradlew build

- name: Test plugin (generate Java code)
Expand All @@ -41,13 +39,11 @@ jobs:

- name: Set version
id: set-version
working-directory: ./codegen
run: ./gradlew properties | grep "^version:" | awk '{print $2}' | { read v; echo "::set-output name=version::$v"; }

- name: Print version
run: echo ${{ steps.set-version.outputs.version }}

- name: Publish plugin
if: github.event_name == 'push' && endsWith(steps.set-version.outputs.version, 'SNAPSHOT') == false
working-directory: ./codegen
run: ./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}
31 changes: 31 additions & 0 deletions RELEASE_OPERATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Release Operations

## Run the Gradle release task

The Gradle release task creates a release commit and push it to the origin/master branch.

```
$ git checkout master
$ git pull
$ ./gradlew release -Prelease.releaseVersion=1.0.0 -Prelease.newVersion=1.1.0-SNAPSHOT
```

The value of `release.releaseVersion` is decided by the draft name of
[Releases](https://github.com/domaframework/doma/releases).

## Build and Publish with GitHub Action

(No operation required)

The GitHub Action workflow [Java CI with Gradle](.github/workflows/ci.yml) handles the above push event
and publishes to the [Gradle Plugin Portal](https://plugins.gradle.org/).

## Publish release notes

Open [Releases](https://github.com/domaframework/doma-compile-plugin/releases)
and publish release notes.

## Announce the release

Announce the release of new version using Twitter.
- [@domaframework](https://twitter.com/domaframework)
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
base
id("net.researchgate.release") version "2.8.1"
}

configure<net.researchgate.release.ReleaseExtension> {
newVersionCommitMessage = "[Gradle Release Plugin] - [skip ci] new version commit: "
}
Binary file modified codegen-test/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion codegen-test/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 17 additions & 1 deletion codegen-test/gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion codegen-test/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
67 changes: 0 additions & 67 deletions codegen/build.gradle

This file was deleted.

73 changes: 73 additions & 0 deletions codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
plugins {
id("groovy")
id("java-gradle-plugin")
id("com.diffplug.spotless") version "5.4.0"
id("com.gradle.plugin-publish") version "0.11.0"
}

gradlePlugin {
plugins {
create("codegenPlugin") {
id = "org.seasar.doma.codegen"
displayName = "Doma Codegen Plugin"
description = "Generates Java, Kotlin, and SQL files from Database"
implementationClass = "org.seasar.doma.gradle.codegen.CodeGenPlugin"
}
}
}

pluginBundle {
website = "https://github.com/domaframework/doma-codegen-plugin"
vcsUrl = "https://github.com/domaframework/doma-codegen-plugin.git"
tags = listOf("doma", "generator")
}

sourceSets {
main {
java {
setSrcDirs(emptyList<String>())
}
withConvention(GroovySourceSet::class) {
groovy {
setSrcDirs(listOf("src/main/groovy", "src/main/java"))
}
}
}
}

spotless {
java {
googleJavaFormat("1.7")
}
groovy {
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
implementation("org.freemarker:freemarker:2.3.30")
testImplementation("org.seasar.doma:doma-core:2.41.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
}

tasks {
test {
useJUnitPlatform()
}

groovydoc {
enabled = false
}
}
1 change: 0 additions & 1 deletion codegen/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
group=org.seasar.doma
version=1.2.2-SNAPSHOT
Binary file removed codegen/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 0 additions & 6 deletions codegen/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading

0 comments on commit d98d0d7

Please sign in to comment.