From 46d1956f8d65de9f8ca5abb519715bde14d6f705 Mon Sep 17 00:00:00 2001 From: axi92 Date: Fri, 26 Jul 2024 18:14:11 +0200 Subject: [PATCH 01/11] chore: load correct sdk package from github --- .gitignore | 2 +- README.md | 3 +++ android/build.gradle | 2 +- example/android/app/build.gradle | 8 ++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 62ba82b..1b38f2f 100644 --- a/.gitignore +++ b/.gitignore @@ -139,4 +139,4 @@ example/android/app/build/ example/vendor/ example/android/.idea/ example/android/local.properties - +android/build diff --git a/README.md b/README.md index 80ffedb..771f83a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ The EVVA React-Native Module is a collection of tools to work with electronical ## Requirements + Java 17+ + Android SDK + xCode react-native < 0.74.3 iOS 15.0+ Android 10+ (API level 29) diff --git a/android/build.gradle b/android/build.gradle index b3558b8..f0df3a4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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" } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 7f8cc4f..b6de2e4 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -114,8 +114,12 @@ repositories { mavenCentral() mavenLocal() maven { - name = "evva-maven" - url = url = uri("https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android") + name = 'evva-maven' + url = url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android') + credentials { + username = project.findProperty('github.user') ?: System.getenv('USERNAME') + password = project.findProperty('github.key') ?: System.getenv('TOKEN') + } } } From be3d5c1aa89d9efb2e91af542374248bd16017ef Mon Sep 17 00:00:00 2001 From: axi92 Date: Mon, 29 Jul 2024 15:35:31 +0200 Subject: [PATCH 02/11] ci: load auth credentials for github packages --- example/android/app/build.gradle | 17 +++++++++++++++-- example/android/local.properties.template | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 example/android/local.properties.template diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index b6de2e4..dc356a9 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -109,6 +109,19 @@ 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() @@ -117,8 +130,8 @@ repositories { name = 'evva-maven' url = url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android') credentials { - username = project.findProperty('github.user') ?: System.getenv('USERNAME') - password = project.findProperty('github.key') ?: System.getenv('TOKEN') + username = properties.getProperty('github.username') ?: System.getenv('GITHUB_USERNAME') + password = properties.getProperty('github.token') ?: System.getenv('GITHUB_TOKEN') } } } diff --git a/example/android/local.properties.template b/example/android/local.properties.template new file mode 100644 index 0000000..c606ccc --- /dev/null +++ b/example/android/local.properties.template @@ -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= \ No newline at end of file From b005f7a09e226bbdf5e15649fcf8048465d95f39 Mon Sep 17 00:00:00 2001 From: axi92 Date: Mon, 29 Jul 2024 15:53:44 +0200 Subject: [PATCH 03/11] build: fix typo in build.gradle --- example/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index dc356a9..e103335 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -128,7 +128,7 @@ repositories { mavenLocal() maven { name = 'evva-maven' - url = url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android') + url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android') credentials { username = properties.getProperty('github.username') ?: System.getenv('GITHUB_USERNAME') password = properties.getProperty('github.token') ?: System.getenv('GITHUB_TOKEN') From 345026988067d299ee1bdfc105eb9cee90a9c8eb Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 15:06:55 +0200 Subject: [PATCH 04/11] build: add workflow for android build Signed-off-by: axi92 --- .github/workflows/android.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..14b1730 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,31 @@ +name: Node.js lint +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: 'lts' + run: | + corepack yarn + cd example && yarn install + + - name: Build android example app + run: yarn build:android \ No newline at end of file From 794b9d6843dd12da8a512df46641c60f9631963b Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 15:09:52 +0200 Subject: [PATCH 05/11] build: fix name of android build Signed-off-by: axi92 --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 14b1730..e6a1dbd 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,4 +1,4 @@ -name: Node.js lint +name: Android on: push: branches: [ "main" ] From d93d6fe23ff9b9188a939449f143c1fe1086e857 Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 15:42:17 +0200 Subject: [PATCH 06/11] build: fix yaml workflow syntax Signed-off-by: axi92 --- .github/workflows/android.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e6a1dbd..8c03e64 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -20,10 +20,10 @@ jobs: uses: android-actions/setup-android@v3 - name: Setup Nodejs - - uses: actions/setup-node@v4 + uses: actions/setup-node@v4 with: node-version: 'lts' - run: | + - run: | corepack yarn cd example && yarn install From 1edbc63e79918ac1a540220cf7d0190584d71c13 Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 15:52:10 +0200 Subject: [PATCH 07/11] build: pin node version for android workflow Signed-off-by: axi92 --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8c03e64..b47991b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Nodejs uses: actions/setup-node@v4 with: - node-version: 'lts' + node-version: '22' - run: | corepack yarn cd example && yarn install From 0d7f6dd47335bd6c0691a3200178aefb58511e35 Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 16:11:59 +0200 Subject: [PATCH 08/11] build: use workflow actor as GITHUB_USERNAME Signed-off-by: axi92 --- .github/workflows/android.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b47991b..3377841 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -28,4 +28,6 @@ jobs: cd example && yarn install - name: Build android example app - run: yarn build:android \ No newline at end of file + run: yarn build:android + env: + GITHUB_USERNAME: ${{ github.actor }} \ No newline at end of file From 67f090b558e224bb028be18db62a6c1b86cb0ccd Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 16:29:17 +0200 Subject: [PATCH 09/11] build: access github variables in workflow Signed-off-by: axi92 --- .github/workflows/android.yml | 3 ++- example/android/app/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3377841..26d2908 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -30,4 +30,5 @@ jobs: - name: Build android example app run: yarn build:android env: - GITHUB_USERNAME: ${{ github.actor }} \ No newline at end of file + GH_USERNAME: ${{ vars.USERNAME }} + GH_TOKEN: ${{ secrets.TOKEN }} \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index e103335..5a29035 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -130,8 +130,8 @@ repositories { name = 'evva-maven' url = uri('https://maven.pkg.github.com/evva-sfw/abrevva-sdk-android') credentials { - username = properties.getProperty('github.username') ?: System.getenv('GITHUB_USERNAME') - password = properties.getProperty('github.token') ?: System.getenv('GITHUB_TOKEN') + username = properties.getProperty('github.username') ?: System.getenv('GH_USERNAME') + password = properties.getProperty('github.token') ?: System.getenv('GH_TOKEN') } } } From 6c7f9af107238f13eacc193e875fd3314013cc1d Mon Sep 17 00:00:00 2001 From: axi92 Date: Tue, 30 Jul 2024 17:15:14 +0200 Subject: [PATCH 10/11] build: add README section for setup github auth PAT Signed-off-by: axi92 --- .github/workflows/android.yml | 1 + README.md | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 26d2908..d1bf0a2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -31,4 +31,5 @@ jobs: run: yarn build:android env: GH_USERNAME: ${{ vars.USERNAME }} + # PAT has read:packages permissions GH_TOKEN: ${{ secrets.TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 771f83a..4092f65 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,11 @@ The EVVA React-Native Module is a collection of tools to work with electronical ``` yarn add ``` + +### 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: From 38335c42594dde64ff0d89b1d40e0321c148395e Mon Sep 17 00:00:00 2001 From: codepushr <1425202+codepushr@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:18:30 +0200 Subject: [PATCH 11/11] chore: update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4092f65..ffd5899 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The EVVA React-Native Module is a collection of tools to work with electronical Java 17+ Android SDK - xCode + Xcode 15+ react-native < 0.74.3 iOS 15.0+ Android 10+ (API level 29) @@ -123,4 +123,4 @@ AbrevvaBle.disengage( isPermanentRelease: '', timeout: 10_000 ); -``` \ No newline at end of file +```