Publish (Android) #1
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
name: Publish (Android) | |
on: | |
workflow_call: | |
inputs: | |
snapshot: | |
required: true | |
type: boolean | |
description: "If the publication is for a snapshot version." | |
default: false | |
branch: | |
description: Target branch | |
type: string | |
required: false | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish_android_package: | |
name: Publish Android Package to Github Packages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r26 | |
add-to-path: false | |
link-to-sdk: true | |
- name: Install Rust toolchain | |
run: | | |
rustup show | |
rustup component add rustfmt clippy | |
- name: Setup Rust toolchains | |
run: | | |
rustup target add armv7-linux-androideabi | |
rustup target add i686-linux-android | |
rustup target add aarch64-linux-android | |
rustup target add x86_64-linux-android | |
- name: Gradle Wrapper | |
run: | | |
gradle wrapper | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set pub mode env var | |
# Note: This step is intended to allow publishing snapshot packages. | |
# It allows to optionally append the property -PSNAPSHOT to the gradle | |
# publication task on the next step, resulting in the package version | |
# following the convention '<version>-SNAPSHOT'. | |
run: | | |
if [[ "${{ inputs.snapshot }}" == "true" ]]; then | |
echo "PUB_MODE=-PSNAPSHOT" >> $GITHUB_ENV | |
fi | |
- name: Gradle Publish Android Package | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publishAndroidReleasePublicationToGithubPackagesRepository ${{ env.PUB_MODE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |