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

build: apply changelog gradle plugin #21

Merged
merged 15 commits into from
May 2, 2024
5 changes: 4 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -32,4 +33,6 @@ jobs:
chmod +x ./generate_docs.sh
./generate_docs.sh
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
- name: Deploy to GitHub Pages
run: mkdocs gh-deploy --force
if: github.ref == 'refs/heads/main'
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ jobs:
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^VERSION_NAME:" | cut -f2- -d ' ')"
chmod +x ./get_changelog.sh
CHANGELOG="$(./get_changelog.sh $VERSION)"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "changelog=$(echo "$CHANGELOG" | base64 )" >> $GITHUB_OUTPUT

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
Expand All @@ -74,4 +77,4 @@ jobs:
gh release create v${{ steps.properties.outputs.version }} \
--draft \
--title "v${{ steps.properties.outputs.version }}" \
--notes "$(echo "${{ steps.properties.outputs.changelog }}" | base64 --decode)"
--notes "$(echo "${{ steps.properties.outputs.changelog }}")"git
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

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

Mosaic Slider offers a wide range of customization including custom Thumbs, custom Values Distribution and more


You can learn more about Mosaic on our [documentation page](https://monstar-lab-oss.github.io/android-mosaic/)
- With our first Mosaic Release 🎉 we introduce the first compoment that makes it to the Mosaic Collection: Mosaic Slider.
- Mosaic Slider offers a wide range of customization including custom Thumbs, custom Values Distribution and more
- You can learn more about Mosaic on our [documentation page](https://monstar-lab-oss.github.io/android-mosaic/)
13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.changelog.date

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
Expand All @@ -9,6 +10,8 @@ plugins {
alias(libs.plugins.detekt) apply false
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.gradle.maven.publish) apply false
alias(libs.plugins.changelog) // Gradle Changelog Plugin

}


Expand Down Expand Up @@ -38,4 +41,14 @@ spotless {
)
)
}
}

changelog {
path.set(file("CHANGELOG.md").canonicalPath)
header.set(provider { "[${version.get()}] - ${date()}" })
headerParserRegex.set("""(\d+\.\d+)""".toRegex())
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
lineSeparator.set("\n")
}
5 changes: 0 additions & 5 deletions demo/src/main/java/io/monstarlab/mosaic/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package io.monstarlab.mosaic.ui.theme

import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

private val DarkColorScheme = darkColorScheme(
primary = Purple80,
Expand Down Expand Up @@ -39,7 +35,6 @@ fun MosaicTheme(
dynamicColor: Boolean = true,
content: @Composable () -> Unit,
) {

MaterialTheme(
colorScheme = DarkColorScheme,
typography = Typography,
Expand Down
26 changes: 0 additions & 26 deletions get_changelog.sh

This file was deleted.

3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ composeBom = "2024.04.01"
spotless="6.25.0"
detekt="1.23.5"
gradle-maven-publsih ="0.28.0"
changelog = "2.1.2"


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

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.monstarlab.mosaic.slider

<<<<<<< HEAD
import io.monstarlab.mosaic.slider.distribution.CheckPointsValuesDistribution
=======
>>>>>>> origin/main
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertThrows
Expand All @@ -12,20 +9,12 @@ import org.junit.Test

class CheckPointsValueDistributionTest {

<<<<<<< HEAD
private lateinit var checkPointsValueDistribution: CheckPointsValuesDistribution
=======
private lateinit var checkPointsValueDistribution: CheckPointsValueDistribution
>>>>>>> origin/main
private val accuracy = 0.0001f

@Before
fun setUp() {
<<<<<<< HEAD
checkPointsValueDistribution = CheckPointsValuesDistribution(
=======
checkPointsValueDistribution = CheckPointsValueDistribution(
>>>>>>> origin/main
listOf(
0f to 0f,
25f to 25f,
Expand All @@ -41,13 +30,8 @@ class CheckPointsValueDistributionTest {

@Test
fun `test create from pairs with decreasing value`() {
<<<<<<< HEAD
assertThrows(CheckPointsValuesDistribution.DecreasingValueException::class.java) {
CheckPointsValuesDistribution(
=======
assertThrows(CheckPointsValueDistribution.DecreasingValueException::class.java) {
CheckPointsValueDistribution(
>>>>>>> origin/main
listOf(
0f to 0f,
5f to 10f,
Expand Down
Loading