Skip to content

Android CI

Android CI #6

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# The jobs to run as part of this workflow
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Environment variables
env:
# Set the JAVA_HOME environment variable
JAVA_HOME_17_X64: /usr/lib/jvm/adoptopenjdk-17-hotspot-amd64
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Print Secret
env:
MY_SECRET: ${{ secrets.GPG_SECRET_KEY }}
run: |
# Print a masked version of the secret for debugging
echo "Hello, secret: ${MY_SECRET:0:100}****"
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- id: install-secret-key
name: Install and Verify GPG Secret Key
run: |
# Save the secret key to a file
echo "${{ secrets.GPG_SECRET_KEY }}" > secret_key.asc
# Print the first and last few lines to check if content is correct
echo "First few lines of the GPG key:"
head -n 5 secret_key.asc
echo "Last few lines of the GPG key:"
tail -n 5 secret_key.asc
# Attempt to import the GPG key
gpg --batch --import secret_key.asc
- name: Setup Android SDK
uses: android-actions/setup-android@v2.0.10
- name: Generate Artifacts
uses: ./gradlew generateArtifacts
- name: Generate CheckSum
uses: ./gradlew generateCheckSum
- name: Sign Artifacts
uses: ./gradlew signArtifacts
- name: Create bundle
uses: ./gradlew createBundle
- id: publish-to-central
name: Publish to Central Repository
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME_TOKEN }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD_TOKEN }}
run: |
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \
clean deploy