Skip to content
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
115 changes: 115 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
name: Build

on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
push:
branches:
- master
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 9477386

- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'

- name: Set up environment
run: |
echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV
echo "COMMIT_PREFIX=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Decode debug keystore
env:
DEBUG_KEYSTORE: ${{ secrets.DEBUG_KEYSTORE }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add secret value to repo

NOTE: secrets are never available to PRs from forks as they can only access secrets in their own repo

run: |
if [ -z "$DEBUG_KEYSTORE" ]
then
echo "No debug keystore value"
else
echo $DEBUG_KEYSTORE > debug.keystore.base64
base64 --decode debug.keystore.base64 > debug.keystore
sudo cp -f debug.keystore /root/.android/.
fi

- name: Build artifact
run: ./gradlew assemble

- name: Copy artifact
run: |
mkdir moonlight-android
cp app/build/outputs/apk/root/debug/app-root-debug.apk "moonlight-android/app-root-debug-${COMMIT_PREFIX}.apk"
cp app/build/outputs/apk/nonRoot/debug/app-nonRoot-debug.apk "moonlight-android/app-nonRoot-debug-${COMMIT_PREFIX}.apk"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: moonlight-android
path: ${{ github.workspace }}/moonlight-android
if-no-files-found: error

release:
name: Release
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/master'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: What event is desirable to trigger the release? This logic will be for every merge (similar to what I do in Sunshine)


steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Re-zip artifacts
run: |
cd dist
COMMIT_PREFIX=$(echo ${{ github.sha }} | cut -c1-8)
for artifact in *.apk
do
file_name="${artifact%.apk}"
echo "-> Creating ${file_name//-${COMMIT_PREFIX}/}.zip"
zip "${file_name//-${COMMIT_PREFIX}/}.zip" "${file_name}.apk"
done

- name: Update Git Tag
run: |
git tag -f Pre-release
git push -f origin Pre-release

- name: Create Release
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: Pre-release
artifacts: "dist/*.zip"
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ You can follow development on our [Discord server](https://moonlight-stream.org/
* [F-Droid](https://f-droid.org/packages/com.limelight)
* [APK](https://github.com/moonlight-stream/moonlight-android/releases)

## Nightly builds
| Name | Status | File |
|-------------------------|-----------------------------------|-----------------------------------------------------|
| app nonRoot debug | [![Build Status][Build]][Actions] | [![moonlight-android][Download]][app nonRoot debug] |
| app Root debug | [![Build Status][Build]][Actions] | [![moonlight-android][Download]][app root debug] |

[Actions]: https://github.com/moonlight-stream/moonlight-android/actions/workflows/build.yml
[Build]: https://github.com/moonlight-stream/moonlight-android/actions/workflows/build.yml/badge.svg
[Download]: https://img.shields.io/badge/Download-blue
[app nonRoot debug]: https://github.com/moonlight-stream/moonlight-android/releases/download/Pre-release/app-nonRoot-debug.zip
[app root debug]: https://github.com/moonlight-stream/moonlight-android/releases/download/Pre-release/app-root-debug.zip

## Building
* Install Android Studio and the Android NDK
* Run ‘git submodule update --init --recursive’ from within moonlight-android/
Expand All @@ -26,9 +38,9 @@ You can follow development on our [Discord server](https://moonlight-stream.org/

## Authors

* [Cameron Gutman](https://github.com/cgutman)
* [Diego Waxemberg](https://github.com/dwaxemberg)
* [Aaron Neyer](https://github.com/Aaronneyer)
* [Cameron Gutman](https://github.com/cgutman)
* [Diego Waxemberg](https://github.com/dwaxemberg)
* [Aaron Neyer](https://github.com/Aaronneyer)
* [Andrew Hennessy](https://github.com/yetanothername)

Moonlight is the work of students at [Case Western](http://case.edu) and was
Expand Down