Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use commit-and-tag-version for Release Management #32

Merged
merged 16 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
32 changes: 32 additions & 0 deletions .github/workflows/deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: deployment
Chrylo marked this conversation as resolved.
Show resolved Hide resolved

concurrency: production

on:
push:
tags:
- 'release/v*'

jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Set Release Version
run: ./gradlew setReleaseVersion # Do not chain this command because it writes into a file which needs to be re-read inside the next gradle command

- name: Publish Library
run: ./gradlew publishReleasePublicationToGithubPackagesRepository
-Pgpr.repository=${{ github.repository }}
-Pgpr.user=${{ github.actor }}
-Pgpr.token=${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: deployment

concurrency: production

on:
push:
branches:
- main

jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Update Version
run: npm run bump-release # Updates the semantic version depending on the last commits e.g. feature / bugfix

- name: Set Snapshot Version
run: ./gradlew setSnapshotVersion # Do not chain this command because it writes into a file which needs to be re-read inside the next gradle command

- name: Publish Library
run: ./gradlew publishReleasePublicationToGithubPackagesRepository
-Pgpr.repository=${{ github.repository }}
-Pgpr.user=${{ github.actor }}
-Pgpr.token=${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"bumpFiles": [
{
"filename": "version",
"type": "plain-text"
}
],
"types": [
{"type": "feature", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "docs", "section": "Documentation"},
{"type": "perf", "section": "Performance"},
{"type": "refactor", "section": "Refactoring"},
{"type": "revert", "section": "Reverts"},
{"type": "test", "hidden": true},
{"type": "chore", "hidden": true},
{"type": "style", "hidden": true}
],
"preMajor": true
}
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## 0.1.0 (2023-11-09)


### Features

* Add Centralized Versioning ([d7a946c](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/d7a946ccaaef9898e3d02a9b3f879e897ac1df0f))
* Add Unsubscribe API to SDK ([69c6294](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/69c62943780046316e4c04b91a063cef63679d0d)), closes [#18](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/18) [#20](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/20)
* Add update API for generated specifications ([9f150e8](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/9f150e801929c8836290c6db9dd76bee37d12340)), closes [#23](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/23)
* Add VSS Symbol Processing processor ([18926ee](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/18926ee0cb15f534855e9dd646c1a30e2542719c))
* Correctly trigger Actuator Target Events ([3c2428b](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/3c2428b0efa73d75aee00b4632011b6f7caf7de3)), closes [#29](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/29)
* Disable Obfuscation ([0d66d97](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/0d66d97c398531fe9429e0f0d19285dbea3eaf1d)), closes [#5](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/5)
* Generate Dash License Report ([5fdc0d1](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/5fdc0d14a39b2259cfc13ae093a3ffb01e622edb)), closes [#2](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/2)
* Limit Maximum Number of Logs ([07a808a](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/07a808aad2d8a5dcfb4aa51e1efe67e3826633e2)), closes [#19](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/19)
* Make Certificate Selectable in TestApp ([34a4b4c](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/34a4b4c250d3b8da53ff912578e74e93b246efb8)), closes [#15](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/15)
* Notify about DataBroker Disconnect ([47e378b](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/47e378bdacbe37e2c4b497a30872418244bc3537)), closes [#12](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/12)
* Publish Kuksa SDK Snapshot Builds to MavenLocal ([eb63872](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/eb63872da13e929b9664dc7904cc743ff0123867)), closes [#6](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/issues/6)
* Use commit-and-tag-version for Release Management ([ea0866a](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/ea0866a2ec5df4db793cb932e5a5f2b516d9309b))


### Documentation

* Adapt Architecture Documentation ([0fbb6ab](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/0fbb6ab2af1b08156860f7cdb74650db458d50ef))
* Add class diagram for vss-core ([d00dc8e](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/d00dc8e79602bcbb0716804b0b9d7468dcccd022))
* Add class diagram for vss-processor ([a22b083](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/a22b083f010899a63acb19e03bf04d30603c6590))
* Add release HowTo docs ([b51059b](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/b51059bf0c5806e32ccd9ddcc1ea85cb7c91ef97))
* Improve documentation ([61b34cc](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/61b34cc903a9ecaff1c84b5451d14340ce2daaaa))


### Performance

* Apply build analyser recommendations ([2a108c3](https://github.com/SoftwareDefinedVehicle/kuksa-sdk-android/commit/2a108c3bf0dbe9688d781f2f199c8deaba2cd1fd))
102 changes: 0 additions & 102 deletions buildSrc/src/main/kotlin/org/eclipse/kuksa/util/VersionProperties.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.eclipse.kuksa.version

import java.util.Locale

class SemanticVersion(semanticVersion: String) {
val major: Int
val minor: Int
val patch: Int
var suffix: String = ""

val versionString: String
get() {
var version = "$major.$minor.$patch"
if (suffix.isNotEmpty()) {
version += "-$suffix"
}

return version
}

val versionCode: Int
get() {
val decorator = "10"
val paddedMajorVersion = String.format(Locale.ROOT, "%02d", major)
val paddedMinorVersion = String.format(Locale.ROOT, "%02d", minor)
val paddedPatchVersion = String.format(Locale.ROOT, "%02d", patch)

return "$decorator$paddedMajorVersion$paddedMinorVersion$paddedPatchVersion".toInt()
}

init {
val versions = semanticVersion.trim()
.substringBefore("-") // Ignore suffixes like -SNAPSHOT
.split(".")
val suffix = semanticVersion.substringAfter("-", "")

major = versions[0].toInt()
minor = versions[1].toInt()
patch = versions[2].toInt()
this.suffix = suffix

print("New SemanticVersion($versionString)")
}
}
12 changes: 11 additions & 1 deletion buildSrc/src/main/kotlin/publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ val extension = project.extensions.create<PublishPluginExtension>("publish")
afterEvaluate {
publishing {
repositories {
// to be defined
maven {
name = "GithubPackages"

val repository = project.findProperty("gpr.repository") as String? ?: System.getenv("GPR_REPOSITORY")
url = uri("https://maven.pkg.github.com/$repository")

credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USERNAME")
password = project.findProperty("gpr.token") as String? ?: System.getenv("GPR_TOKEN")
}
}
}
publications {
register<MavenPublication>("${extension.mavenPublicationName.get()}") {
Expand Down
Loading