Skip to content

Commit

Permalink
Publish desktop apps using Conveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
fmasa committed Apr 1, 2023
1 parent 9b34ecd commit de08e24
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 46 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/desktop_distribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build

on:
# Runs on pushes targeting the default branch
push:
#tags:
# - '*'
branches: ["conveyor"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
conveyor:
name: "Create desktop distributions"
environment: production
runs-on: ubuntu-22.04
env:
CONVEYOR_AGREE_TO_LICENSE: "1"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- run: ./gradlew jar

- uses: hydraulic-software/conveyor/actions/build@v1
with:
command: make site
signing_key: ${{ secrets.SIGNING_KEY }}
agree_to_license: 1
cache_key: conveyor-${{ matrix.os }}-${{ matrix.arch }}

- uses: actions/upload-artifact@v3
with:
name: download-page
path: output
retention-days: 1

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: download-page
- run: mv output downloads
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
image: fmasa/lebeda:7.4-ci
steps:
- run: "true"
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV

build-bundle:
name: Build release bundle
Expand All @@ -96,8 +98,6 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- run: echo "$KEYSTORE_FILE_BASE64" | base64 -d > app/.keystore
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV
- run: 'echo "version code: $SUPPLY_VERSION_CODE, version name: $SUPPLY_VERSION_NAME"'
- run: ./gradlew bundleRelease
- run: mv app/build/outputs/bundle/release/app-release.aab .
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ firebase-debug.log
firebase-build
ui-debug.log
play-store.json
output
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
</a>
</p>

## Desktop apps

See more at WIKI.

Currently supported platforms:
- Linux (tarball)

## User documentation

For both players and GMs there is a [documentation](https://github.com/fmasa/wfrp-master/wiki) for various features and mechanics used in the app.
Expand Down
8 changes: 0 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
buildscript {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://kotlin.bintray.com/kotlinx")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
classpath("com.android.tools.build:gradle:${Versions.agp}")
classpath("org.jetbrains.compose:compose-gradle-plugin:${Versions.compose}")
Expand Down
26 changes: 26 additions & 0 deletions conveyor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

// This is a hashbang include. You can run the command after the #! to see what
// configuration is being extracted from the Gradle build using the Conveyor plugin.
include "#!./gradlew -q printConveyorConfig"

include required("https://raw.githubusercontent.com/hydraulic-software/conveyor/master/configs/jvm/extract-native-libraries.conf")
include required("/stdlib/jdk/20.0/eclipse.conf")


app {
jvm {
options += "--add-opens=java.base/sun.security.x509=ALL-UNNAMED"
}

display-name = "WFRP Master"
license = "GPL-3"
rdns-name = "cz.frantisekmasa.wfrp-master"
vcs-url = "https://github.com/fmasa/wfrp-master"
icons = "app/src/main/res/mipmap-xxxhdpi/ic_launcher.png"

site {
base-url = "https://fmasa.github.io/wfrp-master/download"
}
}

conveyor.compatibility-level = 8
23 changes: 19 additions & 4 deletions desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@

import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
id("org.jetbrains.compose")
id("dev.hydraulic.conveyor") version "1.4"
}

configurations.all {
attributes {
// https://github.com/JetBrains/compose-jb/issues/1404#issuecomment-1146894731
attribute(Attribute.of("ui", String::class.java), "awt")
}
}

kotlin {
Expand All @@ -25,14 +32,22 @@ kotlin {
}
}

dependencies {
linuxAmd64(compose.desktop.linux_x64)
macAmd64(compose.desktop.macos_x64)
macAarch64(compose.desktop.macos_arm64)
windowsAmd64(compose.desktop.windows_x64)
}

compose.desktop {
application {
mainClass = "cz.frantisekmasa.wfrp_master.desktop.MainKt"
mainClass = "cz.frantisekmasa.wfrp_master.desktop.WfrpMasterApplication"
version = System.getenv("APP_VERSION") ?: "1.0.0"

nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "WFRP Master"
packageVersion = "1.0.0"
packageName = "wfrp-master"
packageVersion = System.getenv("APP_VERSION") ?: "1.0.0"

windows {
menuGroup = "Compose Examples"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,44 @@ import kotlinx.coroutines.launch
import org.kodein.di.compose.withDI

@ExperimentalMaterialApi
fun main() {
application {
withDI(appModule) {
val coroutineScope = rememberCoroutineScope()
object WfrpMasterApplication {
@JvmStatic
fun main(args: Array<String>) {
application {
withDI(appModule) {
val coroutineScope = rememberCoroutineScope()

CompositionLocalProvider(
LocalUrlOpener provides DesktopUrlOpener,
LocalEmailInitiator provides DesktopEmailInitiator,
LocalFileChooserFactory provides { NativeFileChooser(coroutineScope, it) },
LocalFileSaverFactory provides { NativeFileSaver(coroutineScope, it) },
LocalStaticConfiguration provides StaticConfiguration(
isProduction = true,
version = "dev",
platform = Platform.Desktop,
)
) {
Window(onCloseRequest = ::exitApplication) {
Theme {
Startup {
ScreenWithBreakpoints {
val drawerState = rememberDrawerState(DrawerValue.Closed)
CompositionLocalProvider(
LocalUrlOpener provides DesktopUrlOpener,
LocalEmailInitiator provides DesktopEmailInitiator,
LocalFileChooserFactory provides { NativeFileChooser(coroutineScope, it) },
LocalFileSaverFactory provides { NativeFileSaver(coroutineScope, it) },
LocalStaticConfiguration provides StaticConfiguration(
isProduction = true,
version = "dev",
platform = Platform.Desktop,
)
) {
Window(onCloseRequest = ::exitApplication) {
Theme {
Startup {
ScreenWithBreakpoints {
val drawerState = rememberDrawerState(DrawerValue.Closed)

Navigator(
screens = listOf(PartyListScreen),
onBackPressed = {
if (drawerState.isOpen) {
coroutineScope.launch { drawerState.close() }
return@Navigator false
}
Navigator(
screens = listOf(PartyListScreen),
onBackPressed = {
if (drawerState.isOpen) {
coroutineScope.launch { drawerState.close() }
return@Navigator false
}

true
}
) {
DrawerShell(drawerState) {
CurrentScreen()
true
}
) {
DrawerShell(drawerState) {
CurrentScreen()
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
pluginManagement {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://kotlin.bintray.com/kotlinx")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://maven.hq.hydraulic.software")
}
}

rootProject.name = "rpg"
include(":common")
include(":common:firebase")
Expand Down

0 comments on commit de08e24

Please sign in to comment.