Skip to content

Commit f6b53a5

Browse files
authored
build: apply changelog gradle plugin (#21)
1 parent 552e28c commit f6b53a5

File tree

8 files changed

+29
-56
lines changed

8 files changed

+29
-56
lines changed

.github/workflows/docs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- main
66
permissions:
77
contents: write
8+
89
jobs:
910
deploy:
1011
runs-on: ubuntu-latest
@@ -32,4 +33,6 @@ jobs:
3233
chmod +x ./generate_docs.sh
3334
./generate_docs.sh
3435
- run: pip install mkdocs-material
35-
- run: mkdocs gh-deploy --force
36+
- name: Deploy to GitHub Pages
37+
run: mkdocs gh-deploy --force
38+
if: github.ref == 'refs/heads/main'

.github/workflows/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ jobs:
5353
PROPERTIES="$(./gradlew properties --console=plain -q)"
5454
VERSION="$(echo "$PROPERTIES" | grep "^VERSION_NAME:" | cut -f2- -d ' ')"
5555
chmod +x ./get_changelog.sh
56-
CHANGELOG="$(./get_changelog.sh $VERSION)"
56+
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
5757
echo "version=$VERSION" >> $GITHUB_OUTPUT
58-
echo "changelog=$(echo "$CHANGELOG" | base64 )" >> $GITHUB_OUTPUT
58+
59+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
60+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
61+
echo "EOF" >> $GITHUB_OUTPUT
5962
6063
# Remove old release drafts by using the curl request for the available releases with a draft flag
6164
- name: Remove Old Release Drafts
@@ -74,4 +77,4 @@ jobs:
7477
gh release create v${{ steps.properties.outputs.version }} \
7578
--draft \
7679
--title "v${{ steps.properties.outputs.version }}" \
77-
--notes "$(echo "${{ steps.properties.outputs.changelog }}" | base64 --decode)"
80+
--notes "$(echo "${{ steps.properties.outputs.changelog }}")"git

CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
With our first Mosaic Release 🎉 we introduce the first compoment that makes it to the Mosaic Collection: Mosaic Slider.
1211

13-
Mosaic Slider offers a wide range of customization including custom Thumbs, custom Values Distribution and more
14-
15-
16-
You can learn more about Mosaic on our [documentation page](https://monstar-lab-oss.github.io/android-mosaic/)
12+
- With our first Mosaic Release 🎉 we introduce the first compoment that makes it to the Mosaic Collection: Mosaic Slider.
13+
- Mosaic Slider offers a wide range of customization including custom Thumbs, custom Values Distribution and more
14+
- You can learn more about Mosaic on our [documentation page](https://monstar-lab-oss.github.io/android-mosaic/)

build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
2+
import org.jetbrains.changelog.date
23

34
// Top-level build file where you can add configuration options common to all sub-projects/modules.
45
plugins {
@@ -9,6 +10,8 @@ plugins {
910
alias(libs.plugins.detekt) apply false
1011
alias(libs.plugins.kotlin.dokka)
1112
alias(libs.plugins.gradle.maven.publish) apply false
13+
alias(libs.plugins.changelog) // Gradle Changelog Plugin
14+
1215
}
1316

1417

@@ -38,4 +41,14 @@ spotless {
3841
)
3942
)
4043
}
44+
}
45+
46+
changelog {
47+
path.set(file("CHANGELOG.md").canonicalPath)
48+
header.set(provider { "[${version.get()}] - ${date()}" })
49+
headerParserRegex.set("""(\d+\.\d+)""".toRegex())
50+
keepUnreleasedSection.set(true)
51+
unreleasedTerm.set("[Unreleased]")
52+
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
53+
lineSeparator.set("\n")
4154
}

demo/src/main/java/io/monstarlab/mosaic/ui/theme/Theme.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package io.monstarlab.mosaic.ui.theme
22

3-
import android.os.Build
43
import androidx.compose.foundation.isSystemInDarkTheme
54
import androidx.compose.material3.MaterialTheme
65
import androidx.compose.material3.darkColorScheme
7-
import androidx.compose.material3.dynamicDarkColorScheme
8-
import androidx.compose.material3.dynamicLightColorScheme
96
import androidx.compose.material3.lightColorScheme
107
import androidx.compose.runtime.Composable
11-
import androidx.compose.ui.platform.LocalContext
128

139
private val DarkColorScheme = darkColorScheme(
1410
primary = Purple80,
@@ -39,7 +35,6 @@ fun MosaicTheme(
3935
dynamicColor: Boolean = true,
4036
content: @Composable () -> Unit,
4137
) {
42-
4338
MaterialTheme(
4439
colorScheme = DarkColorScheme,
4540
typography = Typography,

get_changelog.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ composeBom = "2024.04.01"
1212
spotless="6.25.0"
1313
detekt="1.23.5"
1414
gradle-maven-publsih ="0.28.0"
15+
changelog = "2.1.2"
16+
1517

1618
[libraries]
1719
kotlin_gradle_plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin"}
@@ -34,6 +36,7 @@ compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
3436
compose-material3 = { module = "androidx.compose.material3:material3" }
3537

3638
[plugins]
39+
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
3740
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
3841
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
3942
android-application = { id = "com.android.application", version.ref = "agp" }

slider/src/test/java/io/monstarlab/mosaic/slider/CheckPointsValueDistributionTest.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package io.monstarlab.mosaic.slider
22

3-
<<<<<<< HEAD
43
import io.monstarlab.mosaic.slider.distribution.CheckPointsValuesDistribution
5-
=======
6-
>>>>>>> origin/main
74
import org.junit.After
85
import org.junit.Assert.assertEquals
96
import org.junit.Assert.assertThrows
@@ -12,20 +9,12 @@ import org.junit.Test
129

1310
class CheckPointsValueDistributionTest {
1411

15-
<<<<<<< HEAD
1612
private lateinit var checkPointsValueDistribution: CheckPointsValuesDistribution
17-
=======
18-
private lateinit var checkPointsValueDistribution: CheckPointsValueDistribution
19-
>>>>>>> origin/main
2013
private val accuracy = 0.0001f
2114

2215
@Before
2316
fun setUp() {
24-
<<<<<<< HEAD
2517
checkPointsValueDistribution = CheckPointsValuesDistribution(
26-
=======
27-
checkPointsValueDistribution = CheckPointsValueDistribution(
28-
>>>>>>> origin/main
2918
listOf(
3019
0f to 0f,
3120
25f to 25f,
@@ -41,13 +30,8 @@ class CheckPointsValueDistributionTest {
4130

4231
@Test
4332
fun `test create from pairs with decreasing value`() {
44-
<<<<<<< HEAD
4533
assertThrows(CheckPointsValuesDistribution.DecreasingValueException::class.java) {
4634
CheckPointsValuesDistribution(
47-
=======
48-
assertThrows(CheckPointsValueDistribution.DecreasingValueException::class.java) {
49-
CheckPointsValueDistribution(
50-
>>>>>>> origin/main
5135
listOf(
5236
0f to 0f,
5337
5f to 10f,

0 commit comments

Comments
 (0)