Skip to content

Commit

Permalink
Make publish step manual
Browse files Browse the repository at this point in the history
  • Loading branch information
janseeger committed Oct 27, 2023
1 parent a1c3cf8 commit 71934b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Build, Test, Release
name: Release

on:
workflow_dispatch:
push:
branches: [ "main" ]
paths-ignore:
- 'README.md'

jobs:
publish:
runs-on: nautilus-build
environment: release
permissions:
actions: read
checks: write
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.gradle.plugins.signing.SigningExtension
import java.io.File
import java.nio.charset.Charset
import java.util.Base64
import java.util.Properties

class AndroidLibraryReleasePlugin : Plugin<Project> {
Expand Down Expand Up @@ -46,20 +44,19 @@ private fun Project.setupReleaseBuild() {

private fun Project.setupVersionInfo() {
val versionProperties = File(project.rootDir, "version.properties")
println("version properties: $versionProperties")
versionProperties.inputStream().use { inputStream ->
Properties().apply {
load(inputStream)
project.version = getVersionCode()
project.version = getVersionName()
}
}
}

private fun Properties.getVersionCode(): Int {
private fun Properties.getVersionName(): String {
val major = (get("majorVersion") as String).toInt()
val minor = (get("minorVersion") as String).toInt()
val patch = (get("patchVersion") as String).toInt()
return major * 10000 + minor * 100 + patch
return "$major.$minor.$patch"
}

private fun Project.setupPublishing(): Publication {
Expand All @@ -68,7 +65,7 @@ private fun Project.setupPublishing(): Publication {
register<MavenPublication>("release") {
groupId = "de.sipgate"
artifactId = project.name
version = "0.1"
version = project.version.toString()

setPom()

Expand Down
4 changes: 4 additions & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
majorVersion=0
minorVersion=0
patchVersion=0
buildNumber=

0 comments on commit 71934b8

Please sign in to comment.