diff --git a/.github/workflows/sync_upstream.yml b/.github/workflows/sync_upstream.yml new file mode 100644 index 000000000..26509e42f --- /dev/null +++ b/.github/workflows/sync_upstream.yml @@ -0,0 +1,45 @@ +name: Sync upstream +on: + workflow_dispatch: + schedule: + - cron: "0 15 * * *" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.WF_TOKEN }} + + - name: sync + id: sync + shell: bash + run: | + git config --global user.name 'j-hc' + git config --global user.email 'j-hc@users.noreply.github.com' + if [[ $(git log | grep Author | head -1) == *"semantic"* ]]; then + git reset --hard HEAD~1 + fi + git remote add upstream https://github.com/revanced/revanced-cli + T=$(git tag --sort=creatordate | tail -1) + git tag -d $(git tag -l) + git fetch upstream --tags -f + + C=$(git rev-list --left-right --count origin/main...remotes/upstream/main | awk '{print$2}') + echo "ahead $C commits" + + if [ "$C" -gt 0 ]; then + echo "rebasing" + git push origin --delete $T + git rebase -X ours upstream/main + git push --tags -f + git push -f + echo ::set-output name=SYNC::1 + else + echo "in sync" + echo ::set-output name=SYNC::0 + fi + diff --git a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt index aff17a0fe..9356df49d 100644 --- a/src/main/kotlin/app/revanced/cli/command/MainCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/MainCommand.kt @@ -24,9 +24,7 @@ private class CLIVersionProvider : IVersionProvider { } @Command( - name = "ReVanced-CLI", - mixinStandardHelpOptions = true, - versionProvider = CLIVersionProvider::class + name = "ReVanced-CLI", mixinStandardHelpOptions = true, versionProvider = CLIVersionProvider::class ) internal object MainCommand : Runnable { val logger = DefaultCliLogger() @@ -119,8 +117,14 @@ internal object MainCommand : Runnable { ) var clean: Boolean = false + @Option(names = ["--rip-lib"], description = ["Rips the lib (arm64-v8a etc.) from the APK"]) + var ripLibs = arrayOf() + @Option(names = ["--custom-aapt2-binary"], description = ["Path to custom aapt2 binary"]) var aaptPath: String = "" + + @Option(names = ["--unsigned"], description = ["Disable signing of the final apk"]) + var unsigned: Boolean = false } override fun run() { @@ -161,7 +165,7 @@ internal object MainCommand : Runnable { Aligning.align(result, args.inputFile, alignedFile) // sign the file - val finalFile = if (!pArgs.mount) { + val finalFile = if (!pArgs.mount && !pArgs.unsigned) { val signedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_signed.apk") Signing.sign( alignedFile, diff --git a/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt b/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt index cfe0c305e..7edaa7b84 100644 --- a/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt +++ b/src/main/kotlin/app/revanced/utils/filesystem/ZipFileSystemUtils.kt @@ -56,6 +56,8 @@ internal class ZipFileSystemUtils( private fun Path.getRelativePath(path: Path): Path = zipFileSystem.getPath(path.relativize(this).toString()) + internal fun deleteRecursively(path: String) = zipFileSystem.getPath(path).deleteRecursively() + // TODO: figure out why the file system is uncompressed by default and how to fix it internal fun uncompress(vararg paths: String) = paths.forEach { Files.setAttribute(zipFileSystem.getPath(it), "zip:method", ZipEntry.STORED) }