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 CI support #436

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,65 @@ jobs:
with:
name: hlsdk-${{ steps.extract_branch.outputs.branch }}-windows-vgui
path: dist-vgui/${{ steps.extract_gamedir.outputs.gamedir }}
build-android:
name: Android
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib cmake ninja-build

- name: Setup Java
uses: actions/[email protected]
with:
distribution: 'microsoft'
java-version: '17'

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Build
run: ./gradlew assembleRelease
working-directory: android
env:
ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/26.1.10909125

- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_apk
if: ${{ env.SIGNING_KEY != '' }}
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}

- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" >> $GITHUB_OUTPUT
id: extract_branch

- name: Upload artifacts (signed)
uses: actions/upload-artifact@v3
if: steps.sign_apk.outcome == 'success'
with:
name: hlsdk-${{ steps.extract_branch.outputs.branch }}-android
path: ${{ steps.sign_app.outputs.signedReleaseFile }}

- name: Upload artifacts (unsigned)
uses: actions/upload-artifact@v3
if: steps.sign_apk.outcome != 'success'
with:
name: hlsdk-${{ steps.extract_branch.outputs.branch }}-android
path: android/app/build/outputs/apk/release/*.apk
Loading