-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
946accd
commit 68f8d69
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: 🤖 Setup Android | ||
description: Setup Android build tools | ||
|
||
inputs: | ||
android-version: | ||
description: Android version | ||
required: true | ||
default: "34" | ||
build-tools-version: | ||
description: Build tools version https://developer.android.com/tools/releases/build-tools | ||
required: true | ||
default: 34.0.0 | ||
cmd-line-version: | ||
description: Command line tools https://developer.android.com/studio#command-line-tools-only | ||
required: true | ||
default: "11076708" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/cache@v4 | ||
id: cache | ||
with: | ||
key: ${{ runner.os }}-android-${{ inputs.android-version }}-tools-${{ inputs.build-tools-version }}-cmd-${{ inputs.cmd-line-version }}-zip | ||
path: /opt/android | ||
|
||
- name: Installing… | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
mkdir --parents /opt/android | ||
# Export environment variables | ||
{ | ||
echo "ANDROID_HOME=/opt/android" | ||
echo "ANDROID_SDK_ROOT=/opt/android" | ||
} >> $GITHUB_ENV | ||
# Install Android Command Line Tools | ||
curl "https://dl.google.com/android/repository/commandlinetools-linux-${CMD_LINE_VERSION}_latest.zip" -o /tmp/cmd-tools.zip \ | ||
&& unzip -d "$ANDROID_HOME" /tmp/cmd-tools.zip \ | ||
&& mv "$ANDROID_HOME"/cmdline-tools "$ANDROID_HOME"/latest \ | ||
&& mkdir "$ANDROID_HOME"/cmdline-tools \ | ||
&& mv "$ANDROID_HOME"/latest "$ANDROID_HOME"/cmdline-tools/latest | ||
# Update PATH | ||
{ | ||
echo "$ANDROID_HOME/tools" | ||
echo "$ANDROID_HOME/tools/bin" | ||
echo "$ANDROID_HOME/platform-tools" | ||
echo "$ANDROID_HOME/cmdline-tools/latest/bin" | ||
} >> $GITHUB_PATH | ||
# Install Android SDKs | ||
yes | sdkmanager --licenses --sdk_root="$ANDROID_HOME" \ | ||
&& sdkmanager --update --sdk_root="$ANDROID_HOME" \ | ||
&& sdkmanager --install --sdk_root="$ANDROID_HOME" \ | ||
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \ | ||
"platforms;android-${ANDROID_VERSION}" \ | ||
"platform-tools" \ | ||
"extras;android;m2repository" \ | ||
"extras;google;m2repository" \ | ||
&& sdkmanager --list | ||
env: | ||
ANDROID_VERSION: ${{ inputs.android-version }} | ||
BUILD_TOOLS_VERSION: ${{ inputs.build-tools-version }} | ||
CMD_LINE_VERSION: ${{ inputs.cmd-line-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: 🤖 Testing setup-android | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-android |