Skip to content

Commit

Permalink
auto update iocipher JNI
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Nov 12, 2024
1 parent a458325 commit bc956b5
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/dep_iocipher_jni.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Auto update iocipher JNI

on:
schedule:
# runs Tue at 12:00 am
- cron: '0 0 * * 2'
push:
workflow_dispatch:
inputs:
version:
description: dummy
default: dummy


jobs:
auto-update-dependencies:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run auto dependency update
run: ./tools/check_iocipher_jni.sh > output.txt

- name: check for changes
run: git diff || echo "no changes"

- name: check if jni update or witness checksums only
id: titletext_str
run: |
(git status 2>/dev/null|grep '^\+' 2>/dev/null|grep 'com.github.zoff99:pkgs_guardianprojectIOCipher' 2>/dev/null && echo "jni version update" && release_tag=$(cat output.txt|grep '__VERSIONUPDATE__'|cut -d':' -f2) && echo "titletext=update iocipher JNI to $release_tag" >> $GITHUB_OUTPUT) || \
(echo "gradle witness checksums update";echo "titletext=update gradle witness checksums 2" >> $GITHUB_OUTPUT;echo "release_tag=" >> $GITHUB_OUTPUT)
- name: cleanup
run: rm -f output.txt

- name: Create Pull Request
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
uses: peter-evans/create-pull-request@v7
with:
commit-message: ${{ steps.titletext_str.outputs.titletext }}
branch: create-pull-request/iocipher
delete-branch: true
title: ${{ steps.titletext_str.outputs.titletext }}
48 changes: 48 additions & 0 deletions tools/check_iocipher_jni.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /bin/bash

_HOME2_=$(dirname $0)
export _HOME2_
_HOME_=$(cd $_HOME2_;pwd)
export _HOME_

basedir="$_HOME_""/../android-refimpl-app/"
cd "$basedir"

r1='https://github.com/zoff99/iocipher_pack'
u1='https://jitpack.io/com/github/zoff99/pkgs_guardianprojectIOCipher/'
u2='/pkgs_guardianprojectIOCipher-'
u3='.aar'
f1='app/build.gradle'

tagspec=''
ver=$(git ls-remote --refs --sort='v:refname' --tags "$r1" 2>/dev/null \
| cut --delimiter='/' --fields=3 2>/dev/null \
| grep '^v' \
| tail -1 2>/dev/null \
| sed -e 's#^v##')


url="$u1""$ver""$u2""$ver""$u3"

tf='./tmpfile2.aar'

wget "$url" -O "$tf" >/dev/null 2>/dev/null
if [ ! -s "$tf" ]; then
echo "new version ""$ver"" not yet uploaded to jitpack"
rm -f "$tf"
exit 0
fi
rm -f "$tf"

echo "__VERSIONUPDATE__:""$ver"

sed -i -e 's#implementation('"'"'com.github.zoff99:pkgs_guardianprojectIOCipher:.*#implementation('"'"'com.github.zoff99:pkgs_guardianprojectIOCipher:'"$ver"''"'"') {#' "$f1"

./gradlew -q calculateChecksums >/dev/null 2>/dev/null # first run add some checking for license text. silly crap!

./gradlew -q calculateChecksums | \
grep -v 'and:sdk:platforms:android.jar' | \
grep -v 'android:sdk:platforms:android.jar' | \
grep -v 'android:sdk:platforms:core-for-system-modules.jar' | \
grep -v '^\(Skipping\|Verifying\|Welcome to Gradle\)' \
> ./app/witness.gradle

0 comments on commit bc956b5

Please sign in to comment.