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

Fix #3: Test, Build, Sign and push to GH releases #6

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build & Publish Release APK

on:
push:
branches:
- '*'
tags:
- '*'
workflow_dispatch:
inputs:
ref:
type: string
description: "The tag to use"

jobs:
build:
name: Build/Test APK
runs-on: ubuntu-latest
steps:

- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: setup jdk
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17

# - name: Run Tests
# run: cd obv_messenger/ && ./gradlew test --stacktrace

- name: Build Release APK
run: cd obv_messenger/ && ./gradlew assembleRelease --stacktrace

- name: Rename APK
run: |
find . -name '*.apk'
mv ./obv_messenger/app/build/outputs/apk/prodFull/release/app-prod-full-release-unsigned.apk Olvid.apk
mv ./obv_messenger/app/build/outputs/apk/prodNogoogle/release/app-prod-nogoogle-release-unsigned.apk Olvid-nogoogle.apk

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: Olvid*.apk

release:
name: Sign/Release APK
needs: build
if: startsWith(inputs.ref || github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:

- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
fetch-depth: 0

- name: Download APK from build
uses: actions/download-artifact@v3
with:
name: apk

- name: setup jdk
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17

- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: .
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "32.0.0"

- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Upload Release APK
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.previoustag.outputs.tag }}
files: |
Olvid.apk
Olvid-nogoogle.apk
Olvid-signed.apk
Olvid-nogoogle-signed.apk
70 changes: 70 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Rebase and tag

on:
workflow_dispatch:
# inputs:
# sync_test_mode: # Adds a boolean option that appears during manual workflow run for easy test mode config
# description: 'Test Mode'
# type: boolean
# default: false

jobs:
sync_latest_from_upstream:
name: Sync latest commits from upstream repo and tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:

- name: checkout code
uses: actions/checkout@v4
with:
ref: build-apk
fetch-depth: 0

- name: Sync upstream changes
id: sync
uses: aormsby/[email protected]
with:
target_sync_branch: build-apk
# REQUIRED 'target_repo_token' exactly like this!
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
target_branch_push_args: '--force'
upstream_sync_branch: main
upstream_sync_repo: olvid-io/olvid-android
upstream_pull_args: '--rebase --tags'

# Set test_mode true during manual dispatch to run tests instead of the true action!!
test_mode: ${{ inputs.sync_test_mode }}

- name: New commits found
if: steps.sync.outputs.has_new_commits == 'true'
run: echo "New commits were found to sync."

- name: No new commits
if: steps.sync.outputs.has_new_commits == 'false'
run: echo "There were no new commits."

- name: Show value of 'has_new_commits'
run: echo ${{ steps.sync.outputs.has_new_commits }}

- name: 'Get Previous tag'
if: steps.sync.outputs.has_new_commits == 'true'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Bump version and push tag
if: steps.sync.outputs.has_new_commits == 'true'
uses: EndBug/latest-tag@latest
with:
github_token: ${{ secrets.GH_TOKEN }}
ref: "${{ steps.previoustag.outputs.tag }}-kumy1"

- name: Trigger build
if: steps.sync.outputs.has_new_commits == 'true'
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
gh workflow run android.yml \
-R kumy/olvid-android \
-F "ref=refs/tags/${{ steps.previoustag.outputs.tag }}-kumy1"
2 changes: 1 addition & 1 deletion obv_messenger/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ android.enableJetifier=false
android.nonFinalResIds=true
android.nonTransitiveRClass=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M"
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M"