Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android release Github Action #7

Merged
merged 17 commits into from
Aug 7, 2023
100 changes: 95 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
name: Release

on:
pull_request:
types:
- opened
branches:
- 'release/**'

push:
branches: ['main']
branches:
- 'release/**'

workflow_dispatch:

jobs:
release:
draft:
name: Draft a release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Get Node project version
id: package-version
uses: martinbeentjes/[email protected]

- name: Draft
uses: softprops/action-gh-release@v1
with:
draft: true
name: v${{ steps.package-version.outputs.current-version}}
tag_name: v${{ steps.package-version.outputs.current-version}}
generate_release_notes: true

desktop:
name: Build desktop installers
needs: draft
env:
GH_TOKEN: ${{ github.token }}

Expand All @@ -18,12 +48,12 @@ jobs:
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- name: Check out Git repository
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Setup
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -35,8 +65,68 @@ jobs:
- name: Build
run: npm run build

- name: Install Electron dependencies
- name: Install ./electron dependencies
run: npm --prefix ./electron ci

- name: Publish
run: npm --prefix ./electron run electron:publish

android:
name: Build Android installers
needs: draft
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Create build folder
run: npm run build

- name: Build app bundle
run: cd android && ./gradlew bundle && ./gradlew assembleRelease

- name: Extract android signing key from env
run: |
echo "${{ secrets.RELEASE_KEYSTORE }}" > android/release.jks.base64
base64 -d android/release.jks.base64 > android/release.decrypted.jks

- name: Sign AAB and APK
run: |
jarsigner -keystore android/release.decrypted.jks -storepass "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" -signedjar ./android/app/build/outputs/bundle/release/app-release-signed.aab ./android/app/build/outputs/bundle/release/app-release.aab release
jarsigner -keystore android/release.decrypted.jks -storepass "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" -signedjar ./android/app/build/outputs/apk/release/app-release-signed.apk ./android/app/build/outputs/apk/release/app-release-unsigned.apk release

- name: Get Node project version
id: package-version
uses: martinbeentjes/[email protected]

- name: Rename files
run: |
mv ./android/app/build/outputs/bundle/release/app-release-signed.aab ./android/app/build/outputs/bundle/release/argentum-online-${{ steps.package-version.outputs.current-version}}.aab
mv ./android/app/build/outputs/apk/release/app-release-signed.apk ./android/app/build/outputs/apk/release/argentum-online-${{ steps.package-version.outputs.current-version}}.apk

- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
name: v${{ steps.package-version.outputs.current-version}}
tag_name: v${{ steps.package-version.outputs.current-version}}
generate_release_notes: true
files: |
./android/app/build/outputs/bundle/release/argentum-online-${{ steps.package-version.outputs.current-version}}.aab
./android/app/build/outputs/apk/release/argentum-online-${{ steps.package-version.outputs.current-version}}.apk
2 changes: 1 addition & 1 deletion electron/electron-builder.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"target": "dmg"
},
"linux": {
"target": ["AppImage", "deb", "rpm", "zip", "tar.gz"]
"target": ["AppImage", "deb", "rpm", "tar.gz"]
}
}
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "argentum-online",
"version": "0.0.1",
"version": "0.0.2",
"description": "Argentum Online",
"author": {
"name": "Franco Llamas",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "argentum-online",
"private": true,
"version": "0.0.1",
"version": "0.0.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down