Skip to content

Commit

Permalink
Update build config and scripts (#6)
Browse files Browse the repository at this point in the history
* update AGP

* update gradle wrapper

* update dependencies

* fix scripts updating Didomi SDK dependency

* update workflows actions
  • Loading branch information
nicolas-chaix-didomi authored Sep 4, 2024
1 parent 6acb1e9 commit 6499e7e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 37 deletions.
16 changes: 4 additions & 12 deletions .github/scripts/check_didomi_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ if [[ ! $localVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
exit 1
fi

mavenVersion=""
mavenUrl="$(curl -s 'https://repo.maven.apache.org/maven2/io/didomi/sdk/android/')"
while read -r line; do
version="$(echo "$line" | sed -r 's/^.+href="([^"]+)".+$/\1/' | sed 's/.$//')"
if [[ $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
mavenVersion="$version"
fi
done <<<"$mavenUrl"

if [[ ! $mavenVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Error while getting local android SDK version ($mavenVersion)"
lastVersion=$(curl -s 'https://repo.maven.apache.org/maven2/io/didomi/sdk/android/maven-metadata.xml' | sed -ne '/release/{s/.*<release>\(.*\)<\/release>.*/\1/p;q;}')
if [[ ! $lastVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Error while getting latest android SDK version ($lastVersion)"
exit 1
fi

if [[ $localVersion == "$mavenVersion" ]]; then
if [[ $localVersion == "$lastVersion" ]]; then
echo "Android SDK last version is $localVersion, no change"
exit 0
fi
Expand Down
17 changes: 4 additions & 13 deletions .github/scripts/update_didomi_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@

buildFile="app/build.gradle"

mavenUrl="https://repo.maven.apache.org/maven2/io/didomi/sdk/android/"
mavenVersion=""

while read -r line; do
version="$(echo "$line" | sed -r 's/^.+href="([^"]+)".+$/\1/' | sed 's/.$//')"
if [[ $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
mavenVersion="$version"
fi
done <<< "$(curl -s "$mavenUrl")"

if [[ ! $mavenVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Error while getting local android SDK version ($mavenVersion)"
lastVersion=$(curl -s 'https://repo.maven.apache.org/maven2/io/didomi/sdk/android/maven-metadata.xml' | sed -ne '/release/{s/.*<release>\(.*\)<\/release>.*/\1/p;q;}')
if [[ ! $lastVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Error while getting latest android SDK version ($lastVersion)"
exit 1
fi

sed -i~ -e "s|io.didomi.sdk:android:[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|io.didomi.sdk:android:$mavenVersion|g" $buildFile || exit 1
sed -i~ -e "s|io.didomi.sdk:android:[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|io.didomi.sdk:android:$lastVersion|g" $buildFile || exit 1

# Cleanup backup files
find . -type f -name '*~' -delete
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up our JDK environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scheduled-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
continue: ${{ steps.check.outputs.continue }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check Didomi SDK version
id: check
Expand All @@ -32,14 +32,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Set up our JDK environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ android {
}

dependencies {
implementation "io.didomi.sdk:android:2.9.0"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.lifecycle:lifecycle-viewmodel:2.6.2"
implementation "com.google.android.gms:play-services-ads:22.6.0"
implementation "com.google.android.material:material:1.11.0"
implementation "io.didomi.sdk:android:2.11.0"
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:2.8.4"
implementation "com.google.android.gms:play-services-ads:23.3.0"
implementation "com.google.android.material:material:1.12.0"
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.2.0' apply false
id 'com.android.application' version '8.5.2' apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Nov 25 11:23:49 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 6499e7e

Please sign in to comment.