diff --git a/.gitea/workflows/flatpak.yaml b/.gitea/workflows/flatpak.yaml new file mode 100644 index 0000000..2050ad5 --- /dev/null +++ b/.gitea/workflows/flatpak.yaml @@ -0,0 +1,34 @@ +on: + push: + # TODO: remove versioning branch once everything works + branches: [main,versioning] + tags: + - '[0-9]+.[0-9]+.[0-9]+' +name: Flatpak +jobs: + flatpak: + name: Flatpak + runs-on: ubuntu-latest + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48 + options: --privileged + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: 'temurin' + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Build Release Uber JAR + run: ./gradlew packageReleaseUberJarForCurrentOS + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: YAEP.flatpak + manifest-path: ./flatpak/ch.dissem.YAEP.yml + cache-key: flatpak-builder-${{ github.sha }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..bd0f144 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,26 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- Yet Another Einstein Puzzle, for Desktop and not-quite-yet Android + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + + +[unreleased]: https://git.dissem.ch/chris/YAEP/compare/1b9c8633c96e479e63afcd7301125ce67247a198...HEAD +[0.0.0]: https://git.dissem.ch/chris/YAEP/releases/tag/0.0.0 diff --git a/build.gradle.kts b/build.gradle.kts index b1d1d42..98710a9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.versions) alias(libs.plugins.sonarqube) alias(libs.plugins.kotlin.kover) + alias(libs.plugins.versioning) alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false alias(libs.plugins.compose) apply false @@ -17,6 +18,24 @@ plugins { alias(libs.plugins.kotlin.android) apply false } +version = "0.0.0-SNAPSHOT" +gitVersioning.apply { + refs { + branch(".+") { + considerTagsOnBranches = true + version = "\${ref}-SNAPSHOT" + } + tag("(?.*)") { + version = "\${ref.version}" + } + } + + // optional fallback configuration in case of no matching ref configuration + rev { + version = "\${commit}" + } +} + sonar { properties { property("sonar.projectKey", "YAEP") diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 9830edb..faf36f6 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -1,4 +1,6 @@ -import org.jetbrains.compose.desktop.application.dsl.TargetFormat +import org.jetbrains.compose.desktop.application.dsl.TargetFormat.Deb +import org.jetbrains.compose.desktop.application.dsl.TargetFormat.Dmg +import org.jetbrains.compose.desktop.application.dsl.TargetFormat.Msi plugins { alias(libs.plugins.kotlin.kover) @@ -29,18 +31,31 @@ compose.desktop { mainClass = "ch.dissem.yaep.ui.desktop.MainKt" nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + val formats = mutableListOf(Deb) packageName = "YAEP" - packageVersion = libs.versions.app.version.name.get() - macOS { - iconFile.set(project.file("icon.icns")) + val baseVersion = version.toString() + packageVersion = baseVersion + if (baseVersion.matches(Regex("[1-9][0-9]*(\\.[0-9]+)(\\.[0-9]+)"))) { + formats.add(Dmg) + macOS { + iconFile.set(project.file("icon.icns")) + } } - windows { - iconFile.set(project.file("icon.ico")) + if (baseVersion.matches(Regex("[1-2]?[0-9]?[0-9]\\.[1-2]?[0-9]?[0-9]\\.[1-6]?[0-9]?[0-9]?[0-9]?[0-9]"))) { + windows { + formats.add(Msi) + iconFile.set(project.file("icon.ico")) + } } linux { + debPackageVersion = if (baseVersion.first().isDigit()) { + baseVersion + } else { + "0-$baseVersion" + } iconFile.set(project.file("icon.png")) } + targetFormats(*formats.toTypedArray()) buildTypes.release.proguard { configurationFiles.from(project.file("proguard-rules.pro")) diff --git a/flatpak/info/ch.dissem.YAEP.metainfo.xml b/flatpak/info/ch.dissem.YAEP.metainfo.xml index a4c3092..a5e27a2 100644 --- a/flatpak/info/ch.dissem.YAEP.metainfo.xml +++ b/flatpak/info/ch.dissem.YAEP.metainfo.xml @@ -81,7 +81,7 @@ https://git.dissem.ch/chris/YAEP - +
  • Initial release
  • diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f89b25b..82172be 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -33,6 +33,7 @@ logging-slf4j = { module = "org.slf4j:slf4j-simple", version = "2.0.17" } logging = ["logging-jvm", "logging-slf4j"] [plugins] +versioning = { id = "me.qoomon.git-versioning", version = "6.4.4"} versions = { id = "com.github.ben-manes.versions", version = "0.53.0" } android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" }