Skip to content

Commit

Permalink
Remove axios plugin in favor of github tag publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
gavlyukovskiy committed Dec 1, 2023
1 parent d3886e3 commit 9be9beb
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 96 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/on-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

name: Tag & Release Workflow
on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Get version from tag
id: get-version
shell: bash
run: |
version="${GITHUB_REF_NAME#v}"
regex="^([0-9]+).([0-9]+).([0-9]+)$"
if [[ $version =~ $regex ]]; then
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
else
echo "Version $version is not a valid SemVer"
exit 1
fi
- name: Build
run: ./gradlew -Pversion=${{ steps.get-version.outputs.version }} publishToMavenLocal

- name: Upload release artifacts to Sonatype
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./gradlew -Pversion=${{ steps.get-version.outputs.version }} publishToSonatype closeAndReleaseSonatypeStagingRepository
56 changes: 0 additions & 56 deletions .github/workflows/release.yml

This file was deleted.

49 changes: 9 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ plugins {
java
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin").version("1.1.0")
id("pl.allegro.tech.build.axion-release").version("1.14.3")
}

scmVersion {
with(tag) {
prefix.set("")
versionSeparator.set("")
}
id("io.github.gradle-nexus.publish-plugin").version("1.3.0")
}

group = "com.github.gavlyukovskiy"
version = scmVersion.version
version = "0.1.0-SNAPSHOT"

val sonatypeUser: String? = project.properties["sonatype_user"]?.toString()
?: System.getenv("SONATYPE_USER")
Expand Down Expand Up @@ -52,7 +44,6 @@ subprojects {
java.sourceCompatibility = JavaVersion.VERSION_17

group = rootProject.group
version = rootProject.version

repositories {
mavenCentral()
Expand Down Expand Up @@ -86,6 +77,10 @@ subprojects {
artifact(sourceJar.get())
artifact(javadocJar.get())

if (version.toString() == "0.1.0-SNAPSHOT") {
throw IllegalStateException("'-Pversion' must be set")
}

pom {
name.set(project.name)
description.set("Spring Boot integration with p6spy, datasource-proxy and flexy-pool")
Expand All @@ -106,6 +101,9 @@ subprojects {
scm {
url.set("https://github.com/gavlyukovskiy/spring-boot-data-source-decorator")
}
issueManagement {
url.set("https://github.com/gavlyukovskiy/spring-boot-data-source-decorator/issues")
}
}
}
}
Expand All @@ -127,32 +125,3 @@ subprojects {
}
}
}

tasks {
val releaseCheck by registering {
doLast {
val errors = ArrayList<String>()
if (!project.hasProperty("release.version")) {
errors.add("'-Prelease.version' must be set")
}
if (System.getenv("GITHUB_ACTIONS") != "true") {
if (!project.hasProperty("release.customUsername")) {
errors.add("'-Prelease.customUsername' must be set")
}
if (!project.hasProperty("release.customPassword")) {
errors.add("'-Prelease.customPassword' must be set")
}
}
if (errors.isNotEmpty()) {
throw IllegalStateException(errors.joinToString("\n"))
}
}
}

verifyRelease {
dependsOn(releaseCheck)
subprojects.forEach {
dependsOn(it.tasks.build)
}
}
}

0 comments on commit 9be9beb

Please sign in to comment.