From d2156abfa7e8662423eed0a03e0a64f494a75cdb Mon Sep 17 00:00:00 2001 From: Ennio Visconti Date: Mon, 17 Jun 2024 10:48:37 +0200 Subject: [PATCH] fix: enhanced dsl and fixed maven version release --- .github/workflows/publish.yml | 10 ++++++++-- src/main/kotlin/com/enniovisco/Main.kt | 4 ++-- src/main/kotlin/com/enniovisco/dsl/Dsl.kt | 5 ++++- test.main.kts | 8 ++++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 23bb3d0..a31d816 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,18 +46,24 @@ jobs: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} restore-keys: ${{ runner.os }}-gradle + - name: Strip the 'v' character from the version number + id: strip + run: echo "${{ needs.infer-version.outputs.version }}" | cut -c 2- + shell: bash + env: + OUTPUT: ${{ needs.infer-version.outputs.version }} - name: Change wrapper permissions run: chmod +x gradlew - name: Run gradle publish (MavenCentral) run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache env: - ORG_GRADLE_PROJECT_projectVersion: ${{ needs.infer-version.outputs.version }} + ORG_GRADLE_PROJECT_projectVersion: ${{ steps.strip.outputs.stripped }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - name: Nyx publish (Github Release) - uses: mooltiverse/nyx-github-action@main + uses: mooltiverse/nyx-github-action env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NYX_RELEASE_TYPES_PUBLICATION_SERVICES: 'GITHUB' diff --git a/src/main/kotlin/com/enniovisco/Main.kt b/src/main/kotlin/com/enniovisco/Main.kt index 2e03826..2da43c8 100644 --- a/src/main/kotlin/com/enniovisco/Main.kt +++ b/src/main/kotlin/com/enniovisco/Main.kt @@ -11,9 +11,9 @@ import java.net.* private typealias ResultData = List> private typealias Metadata = Map -fun main(args: Array, preloaded: Boolean = false) { +fun main(args: Array, preloaded: Boolean = false, toFile : Boolean = true, toConsole: Boolean = false) { println("Running....") - Cli(args, toFile = true, toConsole = true, preloaded = preloaded) { + Cli(args, toFile = toFile, toConsole = toConsole, preloaded = preloaded) { it.title("Tracking") val snapshots = tracking(it) diff --git a/src/main/kotlin/com/enniovisco/dsl/Dsl.kt b/src/main/kotlin/com/enniovisco/dsl/Dsl.kt index 55b8cd2..d28d828 100644 --- a/src/main/kotlin/com/enniovisco/dsl/Dsl.kt +++ b/src/main/kotlin/com/enniovisco/dsl/Dsl.kt @@ -11,6 +11,9 @@ import com.enniovisco.main typealias Browser = com.enniovisco.tracking.Browser class WebMonitor { + val toFile = true + val toConsole = false + fun webSource(init: WebSource.() -> Unit): WebSource { WebSource.init() return WebSource @@ -26,5 +29,5 @@ fun monitor(init: WebMonitor.()-> Unit) { val webmonitor = WebMonitor() webmonitor.init() println("Starting WebMonitor...") - main(emptyArray(), preloaded = true) + main(emptyArray(), preloaded = true, toFile = webmonitor.toFile, toConsole = webmonitor.toConsole) } diff --git a/test.main.kts b/test.main.kts index 73e693f..509334e 100644 --- a/test.main.kts +++ b/test.main.kts @@ -1,20 +1,20 @@ #!/usr/bin/env kotlin -@file:DependsOn("com.enniovisco:webmonitor:v1.2.0-beta.5") +@file:DependsOn("com.enniovisco:webmonitor:v1.2.0-beta.7") ////@file:DependesOn("org.slf4j:slf4j-simple:2.0.13") //@file:DependsOn("io.github.oshai:kotlin-logging-jvm:6.0.9") //@file:DependsOn("org.slf4j:slf4j-api:2.0.7") //@file:DependsOn("ch.qos.logback:logback-classic:1.5.6") import com.enniovisco.dsl.* -import com.enniovisco.* monitor { + webSource { screenWidth = 393 // px screenHeight = 851 // px // To date Google Chrome is the browser with the most stable APIs - browser = Browser.FIREFOX + browser = Browser.CHROME_HEADLESS wait = 0 maxSessionDuration = 5_000 // ms targetUrl = "https://enniovisco.github.io/webmonitor/sample.html" @@ -33,7 +33,7 @@ monitor { } } -println(WebSource.screenWidth) +//println(WebSource.screenWidth) //print( // createHTML().html {