Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
distribution: 'graalvm-community'

- name: Publish Release to Github
run: ./gradlew jreleaserRelease --stacktrace --no-daemon
run: ./gradlew jreleaserRelease -Prelease --stacktrace --no-daemon
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/module-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ jobs:
- name: Prepare maven publish
run: |
if [ -n "${{ inputs.module }}" ]; then
./gradlew publish -Pmodule=${{ inputs.module }}
./gradlew publish -Prelease -Pmodule=${{ inputs.module }}
else
./gradlew publish
./gradlew publish -Prelease
fi
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }}

- name: Release to Maven Central portal
run: ./infra/module-release-with-retry.sh "${{ inputs.module }}" 5 20
run: ./infra/module-release-with-retry.sh "${{ inputs.module }}" 5 20 -Prelease
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Gradle
.gradle/
build/
!buildSrc/src/main/kotlin/io/flamingock/build/

# IDE
.idea/
Expand Down
10 changes: 8 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.flamingock.build.VersionManager
import io.flamingock.build.PrintVersionTask

buildscript {
repositories {
mavenCentral()
Expand All @@ -16,9 +19,10 @@ plugins {

allprojects {
group = "io.flamingock"
version = "1.3.1"
val declaredVersion = "1.3.2-SNAPSHOT"
version = VersionManager.resolveVersion(declaredVersion, project.hasProperty("release"))

extra["templateApiVersion"] = "1.3.3"
extra["templateApiVersion"] = "1.3.4"
extra["flamingockVersion"] = "1.2.1"//for tests

repositories {
Expand All @@ -33,3 +37,5 @@ subprojects {
apply(plugin = "flamingock.release-management")
}
}

tasks.register<PrintVersionTask>("printVersion")
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/io/flamingock/build/PrintVersionTask.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.flamingock.build

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

abstract class PrintVersionTask : DefaultTask() {

@TaskAction
fun print() {
println(project.version)
}
}
17 changes: 17 additions & 0 deletions buildSrc/src/main/kotlin/io/flamingock/build/VersionManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.flamingock.build

object VersionManager {

private const val SNAPSHOT_SUFFIX = "-SNAPSHOT"

fun resolveVersion(declaredVersion: String, isRelease: Boolean): String {
if (!isRelease) return declaredVersion
require(declaredVersion.endsWith(SNAPSHOT_SUFFIX)) {
"Cannot release: version '$declaredVersion' does not end with $SNAPSHOT_SUFFIX. " +
"This prevents accidental double-releases."
}
return declaredVersion.removeSuffix(SNAPSHOT_SUFFIX)
}

fun isSnapshot(version: String): Boolean = version.endsWith(SNAPSHOT_SUFFIX)
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public class SqlTemplate extends AbstractChangeTemplate<SqlTemplateConfig, Templ

private static final Logger logger = LoggerFactory.getLogger(SqlTemplate.class);

public SqlTemplate() {
super();
}

@ApplyTemplate
public void apply(Connection connection) {
execute(connection, applyPayload.getValue());
Expand Down
4 changes: 3 additions & 1 deletion infra/module-release-with-retry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
module=$1
maxAttempts=${2:-3}
waitingSeconds=${3:-20}
shift 3 2>/dev/null || true
extraFlags="$*"

if [ -n "$module" ]; then
MODULE_FLAG="-Pmodule=$module"
Expand All @@ -12,7 +14,7 @@ else
echo "Releasing bundle to Central Portal with max attempts[$maxAttempts] and $waitingSeconds seconds delay"
fi
for (( i=1; i<=maxAttempts; i++ )); do
if ./gradlew jreleaserDeploy $MODULE_FLAG --no-daemon --stacktrace; then
if ./gradlew jreleaserDeploy $MODULE_FLAG $extraFlags --no-daemon --stacktrace; then
exit 0
fi
if [ "$i" -eq "$maxAttempts" ]; then
Expand Down
Loading