Skip to content

android_repo_push

android_repo_push #13

name: Publish to Maven Central
on:
repository_dispatch:
types: [android_repo_push]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Checkout Android Repo
uses: actions/checkout@v4
with:
repository: juspay/hyperswitch-sdk-android
ref: main
path: android
- name: Check android subrepo branch and commit message
id: extract-libs
working-directory: ./android
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$CURRENT_BRANCH" != "main" ]]; then
echo "Not on main branch in android directory. Skipping workflow."
exit 1
fi
COMMIT_MSG=$(git log -1 --pretty=%B)
if [[ ! "$COMMIT_MSG" =~ ^release:\[(.*)\] ]]; then
echo "$COMMIT_MSG"
echo "Invalid commit message format. Expected: release:[lib1,lib2]"
exit 0
fi
LIBS="${BASH_REMATCH[1]}"
echo "Found libraries: $LIBS"
echo "libraries=$LIBS" >> $GITHUB_OUTPUT
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: central
server-username: ${{secrets.ANDROID_CENTRAL_TOKEN_USERNAME }}
server-password: ${{ secrets.ANDROID_CENTRAL_TOKEN_PASSWORD }}
gpg-private-key: ${{ secrets.ANDROID_GPG_SIGNING_KEY }}
gpg-passphrase: ${{ secrets.ANDROID_GPG_SIGNING_KEY_PASSWORD }}
- name: Dependency Install
run: |
# Install dependencies using npm
npm i
npm run re:start
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582
with:
build-root-directory: ./android
- name: Build and Publish
working-directory: ./android
env:
SONATYPE_TOKEN: ${{ secrets.ANDROID_SONATYPE_AUTH_TOKEN }}
SELECTED_LIBRARIES: ${{ steps.extract-libs.outputs.libraries }}
run: |
./build-lib.sh