如此处所述,您应该使用<releaseConfiguration/>
来定义每个新版本需要或需要更新的值。
对于Android,除了 keystore 签名属性,您还可以定义:
喜欢:
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.maven.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<releaseConfiguration>
<versionCode>2</versionCode>
<versionName>3.0</versionName>
<appLabel>MyHelloFX</appLabel>
</releaseConfiguration>
...
因此,如果您需要将 AndroidManifest 添加到src/Android
(在 中生成的那个target/gluonfx/aarch64-android/gensrc/android/AndroidManifest.xml
),以便添加/修改其中的一部分,每当您在 pom.xml 中更改它们时,它将始终针对这三个值进行更新。
关于 CI/CD,请查看HelloGluon CI示例。
它没有自定义清单,但它展示了如何ReleaseConfiguration
在 CI 环境中处理和更新发布值。
pom定义了 releaseConfiguration 块使用的一些属性:
<properties>
...
<main.class>com.gluonhq.hello.HelloGluonApp</main.class>
<app.identifier>${main.class}</app.identifier>
<app.description>The HelloGluon app</app.description>
<version.code/>
<provided.keystore.path/>
</properties>
...
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.maven.plugin.version}</version>
<configuration>
...
<releaseConfiguration>
<vendor>Gluon</vendor>
<description>${app.description}</description>
<packageType>${package.type}</packageType>
<!-- for macOS/iOS -->
<macAppStore>${mac.app.store}</macAppStore>
<bundleShortVersion>${bundle.short.version}</bundleShortVersion>
<bundleVersion>${bundle.version}</bundleVersion>
<!-- for Android -->
<versionCode>${version.code}</versionCode>
<providedKeyStorePath>${provided.keystore.path}</providedKeyStorePath>
...
这些属性最终是为每个配置文件定义的:
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
<app.identifier>com.gluonhq.samples.hellogluon</app.identifier>
<version.code>${env.GITHUB_RUN_NUMBER}</version.code>
...
运行 Android作业时,将使用所需的变量和机密:
- name: Gluon Build
run: mvn -Pandroid gluonfx:build gluonfx:package
env:
GLUON_ANDROID_KEYSTOREPATH: ${{ steps.android_keystore_file.outputs.filePath }}
...