Skip to content

Commit

Permalink
build: workflow for android build (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: axi92 <[email protected]>
Co-authored-by: codepushr <[email protected]>
  • Loading branch information
axi92 and 0x7061 authored Jul 31, 2024
1 parent 97988b3 commit cb294e5
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 5 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Android
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: '22'
- run: |
corepack yarn
cd example && yarn install
- name: Build android example app
run: yarn build:android
env:
GH_USERNAME: ${{ vars.USERNAME }}
# PAT has read:packages permissions
GH_TOKEN: ${{ secrets.TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,4 @@ example/android/app/build/
example/vendor/
example/android/.idea/
example/android/local.properties

android/build
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ The EVVA React-Native Module is a collection of tools to work with electronical

## Requirements

Java 17+
Android SDK
Xcode 15+
react-native < 0.74.3
iOS 15.0+
Android 10+ (API level 29)
Expand All @@ -26,6 +29,11 @@ The EVVA React-Native Module is a collection of tools to work with electronical
```
yarn add <git remote url>
```

### Setup Github auth to load package

Create a copy of [local.properties.template](example/android/local.properties.template) and rename it to local.properties in the same directory. Paste your github username and [classic PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)

### IOS

Add the following to your Podfile:
Expand Down Expand Up @@ -115,4 +123,4 @@ AbrevvaBle.disengage(
isPermanentRelease: '',
timeout: 10_000
);
```
```
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation group: "com.evva.xesar", name: "abrevva-sdk-android", version: "1.0.15"
implementation group: "com.evva.xesar", name: "abrevva-sdk-android", version: "1.0.19"

}

21 changes: 19 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,30 @@ android {
}
}

Properties properties = new Properties()
try {
def propertiesFile = new File(rootProject.rootDir, "local.properties")
if (propertiesFile.exists()) {
properties.load(new FileInputStream(propertiesFile))
println("Properties loaded successfully.")
} else {
println("local.properties file does not exist.")
}
} catch (Exception e) {
println("Failed to load properties: ${e.message}")
}

repositories {
google()
mavenCentral()
mavenLocal()
maven {
name = "evva-maven"
url = url = uri("https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android")
name = 'evva-maven'
url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android')
credentials {
username = properties.getProperty('github.username') ?: System.getenv('GH_USERNAME')
password = properties.getProperty('github.token') ?: System.getenv('GH_TOKEN')
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions example/android/local.properties.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Github only let you load packages with authentication.
# How to create a github token with read permissions on packages is explained here:
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages
github.username=
github.token=

0 comments on commit cb294e5

Please sign in to comment.