Skip to content

Commit 384d068

Browse files
committed
Publish desktop apps using Conveyor
1 parent 9b34ecd commit 384d068

File tree

8 files changed

+171
-46
lines changed

8 files changed

+171
-46
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
tags:
7+
- '*'
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
conveyor:
27+
name: "Create desktop distributions"
28+
environment: production
29+
runs-on: ubuntu-22.04
30+
env:
31+
CONVEYOR_AGREE_TO_LICENSE: "1"
32+
APP_VERSION: ${{ github.ref_name }}
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: actions/setup-java@v3
36+
with:
37+
distribution: 'temurin'
38+
java-version: '17'
39+
40+
- run: ./gradlew jar
41+
42+
- uses: hydraulic-software/conveyor/actions/build@v1
43+
with:
44+
command: make site
45+
signing_key: ${{ secrets.SIGNING_KEY }}
46+
agree_to_license: 1
47+
conveyor_version: "8.0"
48+
cache_key: conveyor-${{ matrix.os }}-${{ matrix.arch }}
49+
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
name: download-page
53+
path: output
54+
retention-days: 1
55+
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: [conveyor]
62+
steps:
63+
- name: Download a single artifact
64+
uses: actions/download-artifact@v3
65+
with:
66+
name: download-page
67+
path: download
68+
- run: mv download/download.html download/index.html
69+
- name: Setup Pages
70+
uses: actions/configure-pages@v3
71+
- name: Upload artifact
72+
uses: actions/upload-pages-artifact@v1
73+
with:
74+
path: '.'
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v2

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373
image: fmasa/lebeda:7.4-ci
7474
steps:
7575
- run: "true"
76+
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
77+
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV
7678

7779
build-bundle:
7880
name: Build release bundle
@@ -96,8 +98,6 @@ jobs:
9698
restore-keys: |
9799
${{ runner.os }}-gradle-
98100
- run: echo "$KEYSTORE_FILE_BASE64" | base64 -d > app/.keystore
99-
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
100-
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV
101101
- run: 'echo "version code: $SUPPLY_VERSION_CODE, version name: $SUPPLY_VERSION_NAME"'
102102
- run: ./gradlew bundleRelease
103103
- run: mv app/build/outputs/bundle/release/app-release.aab .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ firebase-debug.log
2222
firebase-build
2323
ui-debug.log
2424
play-store.json
25+
output

build.gradle.kts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
buildscript {
2-
repositories {
3-
google()
4-
mavenCentral()
5-
maven("https://plugins.gradle.org/m2/")
6-
maven("https://kotlin.bintray.com/kotlinx")
7-
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
8-
}
9-
102
dependencies {
113
classpath("com.android.tools.build:gradle:${Versions.agp}")
124
classpath("org.jetbrains.compose:compose-gradle-plugin:${Versions.compose}")

conveyor.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
// This is a hashbang include. You can run the command after the #! to see what
3+
// configuration is being extracted from the Gradle build using the Conveyor plugin.
4+
include "#!./gradlew -q printConveyorConfig"
5+
6+
include required("https://raw.githubusercontent.com/hydraulic-software/conveyor/master/configs/jvm/extract-native-libraries.conf")
7+
include required("/stdlib/jdk/20.0/eclipse.conf")
8+
9+
10+
app {
11+
jvm {
12+
options += "--add-opens=java.base/sun.security.x509=ALL-UNNAMED"
13+
}
14+
15+
display-name = "WFRP Master"
16+
license = "GPL-3"
17+
rdns-name = "cz.frantisekmasa.wfrp-master"
18+
vcs-url = "https://github.com/fmasa/wfrp-master"
19+
icons = "app/src/main/res/mipmap-xxxhdpi/ic_launcher.png"
20+
21+
site {
22+
base-url = "https://fmasa.github.io/wfrp-master/download"
23+
}
24+
}
25+
26+
conveyor.compatibility-level = 8

desktop/build.gradle.kts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11

2-
import org.jetbrains.compose.compose
32
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
43

54
plugins {
65
kotlin("multiplatform") // kotlin("jvm") doesn't work well in IDEA/AndroidStudio (https://github.com/JetBrains/compose-jb/issues/22)
76
id("org.jetbrains.compose")
7+
id("dev.hydraulic.conveyor") version "1.4"
8+
}
9+
10+
configurations.all {
11+
attributes {
12+
// https://github.com/JetBrains/compose-jb/issues/1404#issuecomment-1146894731
13+
attribute(Attribute.of("ui", String::class.java), "awt")
14+
}
815
}
916

1017
kotlin {
@@ -25,14 +32,22 @@ kotlin {
2532
}
2633
}
2734

35+
dependencies {
36+
linuxAmd64(compose.desktop.linux_x64)
37+
macAmd64(compose.desktop.macos_x64)
38+
macAarch64(compose.desktop.macos_arm64)
39+
windowsAmd64(compose.desktop.windows_x64)
40+
}
41+
2842
compose.desktop {
2943
application {
30-
mainClass = "cz.frantisekmasa.wfrp_master.desktop.MainKt"
44+
mainClass = "cz.frantisekmasa.wfrp_master.desktop.WfrpMasterApplication"
45+
version = System.getenv("APP_VERSION") ?: "1.0.0"
3146

3247
nativeDistributions {
3348
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
34-
packageName = "WFRP Master"
35-
packageVersion = "1.0.0"
49+
packageName = "wfrp-master"
50+
packageVersion = System.getenv("APP_VERSION") ?: "1.0.0"
3651

3752
windows {
3853
menuGroup = "Compose Examples"

desktop/src/jvmMain/kotlin/cz/frantisekmasa/wfrp_master/desktop/Main.kt renamed to desktop/src/jvmMain/kotlin/cz/frantisekmasa/wfrp_master/desktop/WfrpMasterApplication.kt

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,44 @@ import kotlinx.coroutines.launch
2929
import org.kodein.di.compose.withDI
3030

3131
@ExperimentalMaterialApi
32-
fun main() {
33-
application {
34-
withDI(appModule) {
35-
val coroutineScope = rememberCoroutineScope()
32+
object WfrpMasterApplication {
33+
@JvmStatic
34+
fun main(args: Array<String>) {
35+
application {
36+
withDI(appModule) {
37+
val coroutineScope = rememberCoroutineScope()
3638

37-
CompositionLocalProvider(
38-
LocalUrlOpener provides DesktopUrlOpener,
39-
LocalEmailInitiator provides DesktopEmailInitiator,
40-
LocalFileChooserFactory provides { NativeFileChooser(coroutineScope, it) },
41-
LocalFileSaverFactory provides { NativeFileSaver(coroutineScope, it) },
42-
LocalStaticConfiguration provides StaticConfiguration(
43-
isProduction = true,
44-
version = "dev",
45-
platform = Platform.Desktop,
46-
)
47-
) {
48-
Window(onCloseRequest = ::exitApplication) {
49-
Theme {
50-
Startup {
51-
ScreenWithBreakpoints {
52-
val drawerState = rememberDrawerState(DrawerValue.Closed)
39+
CompositionLocalProvider(
40+
LocalUrlOpener provides DesktopUrlOpener,
41+
LocalEmailInitiator provides DesktopEmailInitiator,
42+
LocalFileChooserFactory provides { NativeFileChooser(coroutineScope, it) },
43+
LocalFileSaverFactory provides { NativeFileSaver(coroutineScope, it) },
44+
LocalStaticConfiguration provides StaticConfiguration(
45+
isProduction = true,
46+
version = "dev",
47+
platform = Platform.Desktop,
48+
)
49+
) {
50+
Window(onCloseRequest = ::exitApplication) {
51+
Theme {
52+
Startup {
53+
ScreenWithBreakpoints {
54+
val drawerState = rememberDrawerState(DrawerValue.Closed)
5355

54-
Navigator(
55-
screens = listOf(PartyListScreen),
56-
onBackPressed = {
57-
if (drawerState.isOpen) {
58-
coroutineScope.launch { drawerState.close() }
59-
return@Navigator false
60-
}
56+
Navigator(
57+
screens = listOf(PartyListScreen),
58+
onBackPressed = {
59+
if (drawerState.isOpen) {
60+
coroutineScope.launch { drawerState.close() }
61+
return@Navigator false
62+
}
6163

62-
true
63-
}
64-
) {
65-
DrawerShell(drawerState) {
66-
CurrentScreen()
64+
true
65+
}
66+
) {
67+
DrawerShell(drawerState) {
68+
CurrentScreen()
69+
}
6770
}
6871
}
6972
}

settings.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
maven("https://plugins.gradle.org/m2/")
6+
maven("https://kotlin.bintray.com/kotlinx")
7+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
8+
maven("https://maven.hq.hydraulic.software")
9+
}
10+
}
11+
112
rootProject.name = "rpg"
213
include(":common")
314
include(":common:firebase")

0 commit comments

Comments
 (0)