Skip to content

Commit

Permalink
Google Play Publishing Package Name and Store Art
Browse files Browse the repository at this point in the history
gleblebedev committed Jul 4, 2024
1 parent 86d15bb commit 24f1064
Showing 10 changed files with 110 additions and 8 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
@@ -33,9 +33,20 @@ jobs:
name: v${{ env.BUILD_VERSION }}
tag_name: v${{ env.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check for Secret PLAY_KEYSTORE
id: secret-check
run: |
if [ "${{ secrets.PLAY_KEYSTORE }}" != '' ]; then
echo "HAS_PLAY_KEYSTORE=true" >> $GITHUB_ENV
else
echo "HAS_PLAY_KEYSTORE=false" >> $GITHUB_ENV
fi
outputs:
BUILD_VERSION: ${{ env.BUILD_VERSION }}
ANDROID_VERSION: ${{ env.ANDROID_VERSION }}
HAS_PLAY_KEYSTORE: ${{ env.HAS_PLAY_KEYSTORE }}

# ---------------------------------------------------------------------------------------
build_desktop:
@@ -117,6 +128,8 @@ jobs:
build_android:
needs: set_version
runs-on: ubuntu-latest
env:
ANDROID_PACKAGENAME: "com.companyname.RbfxTemplate.android"

steps:
- uses: actions/checkout@v3
@@ -157,9 +170,25 @@ jobs:
- name: Install Android SDK and Platforms
run: $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platform-tools" "platforms;android-33" --sdk_root=$ANDROID_HOME

- name: Decode Keystore
id: decode_keystore
if: ${{ needs.set_version.outputs.HAS_PLAY_KEYSTORE == 'true' }}
uses: timheuer/base64-to-file@v1
with:
fileDir: '${{ github.workspace }}/RbfxTemplate.Android'
fileName: 'googleplay.jks'
encodedString: ${{ secrets.PLAY_KEYSTORE }}

- name: Dotnet Publish
working-directory: ./RbfxTemplate.Android
run: dotnet publish -f net8.0-android -c Release --no-restore -p:AndroidVersionCode=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
run: |
if [ -n "${{ secrets.PLAY_KEYSTORE }}" ]; then
echo "Secret PLAY_KEYSTORE is defined. Building and signing the aab file."
dotnet publish -f net8.0-android -c Release --no-restore -p:ApplicationId=${{ env.ANDROID_PACKAGENAME }} -p:ApplicationDisplayVersion=${{ needs.set_version.outputs.BUILD_VERSION }} -p:ApplicationVersion=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }} /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=googleplay.jks /p:AndroidSigningKeyAlias=${{secrets.PLAY_KEYSTORE_ALIAS}} /p:AndroidSigningKeyPass="${{ secrets.PLAY_KEYSTORE_PASS }}" /p:AndroidSigningStorePass="${{ secrets.PLAY_KEYSTORE_PASS }}"
else
echo "Secret PLAY_KEYSTORE is not defined. Building with no signature."
dotnet publish -f net8.0-android -c Release --no-restore -p:ApplicationId=${{ env.ANDROID_PACKAGENAME }} -p:ApplicationDisplayVersion=${{ needs.set_version.outputs.BUILD_VERSION }} -p:ApplicationVersion=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
fi
- name: Find APK
run: |
@@ -184,6 +213,17 @@ jobs:
dotnet tool run ezpipeline -- fetch-tool --name Butler -o tools/itch
tools/itch/butler push ${{ env.APK_PATH }} ${{ vars.ITCH_PROJECT }}:android
shell: bash

- uses: r0adkll/upload-google-play@v1.1.3
name: Upload Android Artifact to Play Console
env:
PLAYSTORE_SERVICE_ACC: ${{ secrets.PLAYSTORE_SERVICE_ACC }}
if: ${{ env.PLAYSTORE_SERVICE_ACC != '' }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_SERVICE_ACC }}
packageName: ${{ env.ANDROID_PACKAGENAME }}
releaseFiles: ${{ env.AAB_PATH }}
track: internal
# ---------------------------------------------------------------------------------------
build_uwp:
needs: set_version
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -266,3 +266,5 @@ Shaders.Generated
*.user.json

RbfxTemplate/Content/Common
*.jks
googleplay.txt
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -70,4 +70,66 @@ Navigate to ```Settings > Secrets and variables```.
Add a new secret named **BUTLER_API_KEY** and set its value to your **itch.io** personal access token.
Add new variable **ITCH_PROJECT** to the itch.io project id like [rebelfork/rbfx-csharp-casual](https://rebelfork.itch.io/rbfx-csharp-casual)

That’s it! Your GitHub Actions workflow will now build your game and make it available for download via GitHub Releases. Optionally, it can also publish to itch.io if configured. 🚀🎮
That's it! Your GitHub Actions workflow will now build your game and make it available for download via GitHub Releases. Optionally, it can also publish to itch.io if configured.

## Optional: Google Play Publishing

To publish app to Google Play directly from the GitHub Action you need to define several secrets in the pipeline.

### PLAY_KEYSTORE, PLAY_KEYSTORE_ALIAS and PLAY_KEYSTORE_PASS

First you need to generate Java Key Store file by running the following command:

```shell
keytool -v -genkey -v -keystore googleplay.jks -alias someKindOfName -keyalg RSA -validity 10000
```

**Don't user quotes " as part of the password, it may mess up the GitHub action scripts!**

Replace alias with a name related to you. Store the alias into PLAY_KEYSTORE_ALIAS secret of the GitHub pipeline. The password you set to the keystore should go into PLAY_KEYSTORE_PASS secret.

Also you need to store the whole content of the googleplay.jks file into the PLAY_KEYSTORE secret. The easy way of doing that is to encode the file content into base64 string and store the string value into the secret by running the following command on windows:

```shell
certutil -encodehex -f googleplay.jks googleplay.txt 0x40000001 1>nul
```

or using openssl elsewhere:

```shell
openssl base64 < googleplay.jks | tr -d '\n' | tee googleplay.txt
```

Upload the content of googleplay.txt to PLAY_KEYSTORE variable.

**Dont' forget to delete googleplay.txt and keep the googleplay.jks in a safe place locally!**

More on this: https://thewissen.io/making-maui-cd-pipeline/

### PLAYSTORE_SERVICE_ACC

## Configure access via service account

This step use https://github.com/r0adkll/upload-google-play for the publishing. Here is what you need to do:

1. Enable the Google Play Android Developer API.
1. Go to https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com.
1. Click on Enable.
1. Create a new service account in Google Cloud Platform ([docs](https://developers.google.com/android-publisher/getting_started#service-account)).
1. Navigate to https://cloud.google.com/gcp.
1. Open `Console` > `IAM & Admin` > `Credentials` > `Manage service accounts` > `Create service account`.
1. Pick a name for the new account. Do not grant the account any permissions.
1. To use it from the GitHub Action use either:
- Account key in GitHub secrets (simpler):
1. Open the newly created service account, click on `keys` tab and add a new key, JSON type.
1. When successful, a JSON file will be automatically downloaded on your machine.
1. Store the content of this file to your GitHub secrets, e.g. `PLAYSTORE_SERVICE_ACC`.
1. Add the service account to Google Play Console.
1. Open https://play.google.com/console and pick your developer account.
1. Open Users and permissions.
1. Click invite new user and add the email of the service account created in the previous step.
1. Grant permissions to the app that you want the service account to deploy in `app permissions`.
1. Create new application via Google Play Console
1. Open https://play.google.com/console and pick your developer account.
1. Press `Create App` and create new application using the same ApplicationId as in your c# project
1. Make sure you upload an apk or aab manually first by creating a release through the play console.
7 changes: 2 additions & 5 deletions RbfxTemplate.Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.companyname.RbfxTemplate.android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!-- OpenGL ES 3.0 -->
<uses-feature android:glEsVersion="0x00030000" />
@@ -14,7 +11,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />

<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true">
</application>
1 change: 1 addition & 0 deletions RbfxTemplate.Android/RbfxTemplate.Android.csproj
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<TargetFrameworkVersion>34</TargetFrameworkVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
2 changes: 1 addition & 1 deletion RbfxTemplate/UrhoApplication.cs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ public UrhoApplication(Context context) : base(context)
public override void Setup()
{
// Set up engine parameters
EngineParameters[Urho3D.EpFullScreen] = false;
EngineParameters[Urho3D.EpFullScreen] = false; //Use !Debugger.IsAttached if you need true fullscreen in production.
EngineParameters[Urho3D.EpWindowResizable] = false;
EngineParameters[Urho3D.EpWindowTitle] = "RbfxTemplate";
EngineParameters[Urho3D.EpApplicationName] = "RbfxTemplate";
Binary file added StoreArt/GooglePlay/AppIcon_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StoreArt/GooglePlay/FeatureGraphics_1024_500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StoreArt/GooglePlay/Screenshot1_FullHD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StoreArt/GooglePlay/Screenshot2_FullHD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 24f1064

Please sign in to comment.