Skip to content

updated

updated #1

Workflow file for this run

name: Android CI
on:
push:
branches: [ "master" ]
tags: [ "*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --refresh-dependencies --s
publish:
needs: build # Ensures that the 'publish' job runs after the 'build' job is successful
if: startsWith(github.ref, 'refs/tags/') # Ensure this job only runs for tags
runs-on: ubuntu-latest
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USER_NAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }}
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: extract_version
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
if [[ $TAG_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "SEMVER_TAG=$TAG_NAME" >> $GITHUB_STATE
else
echo "Not a semver tag. Exiting..."
exit 1 # Exit if it is not a semver tag.
fi
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Publish package to Maven Central Repository
run: ./gradlew publishToMavenCentral --no-configuration-cache --s -Pversion=$GITHUB_REF_NAME