Skip to content

Commit

Permalink
Try to get rid of txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanTimchenkoLightspeed committed Jan 14, 2025
1 parent a26676c commit 8e6411b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Build, run tests and upload dev snapshot to Maven Central with Gradle
run: |
./gradlew devSnapshot printDevSnapshotReleaseNote && ./gradlew devSanitizedVersion printSanitizedVersion
./gradlew devSnapshot printDevSnapshotReleaseNote && ./gradlew printSanitizedVersion >> $GITHUB_STEP_SUMMARY
env:
STORE_ID: ${{ secrets.STORE_ID }}
API_TOKEN: ${{ secrets.API_TOKEN }}
Expand All @@ -37,14 +37,6 @@ jobs:
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}

- name: Read sanitized version
id: read_sanitized_version
run: echo "sanitized_version=$(cat sanitized_version.txt)" >> $GITHUB_ENV

- name: Output sanitized version
run: |
echo "Sanitized Version: ${{ env.sanitized_version }}" >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts with checks results
uses: actions/upload-artifact@v3
if: failure()
Expand Down
20 changes: 10 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,12 @@ tasks.register(Tasks.PRINT_DEV_SNAPSHOT_RELEASE_NOTE_TASK_NAME) {
dependsOn(tasks.getByName("devSnapshot"))
}

tasks.register("devSanitizedVersion") {
doLast {
println("Executing devSanitizedVersion task")
}
}


tasks.register(Tasks.PRINT_SUMMARY_SANITIZED_TASK_NAME) {
doLast {
printSanitizedVersion(project.sanitizeVersion())
}
dependsOn(tasks.getByName("devSanitizedVersion"))
}

detekt {
Expand Down Expand Up @@ -287,9 +282,14 @@ fun printDevSnapshotReleaseNote(groupId: String, artifactId: String, sanitizedVe
}

fun printSanitizedVersion(sanitizedVersion: String): String {
val output = "Sanitized version: $sanitizedVersion"
File("sanitized_version.txt").writeText(output)
return output
val markdownMessage = """
|## Sanitized Version
|
|**Version:** $sanitizedVersion
|
""".trimMargin()
println(markdownMessage)
return markdownMessage
}

class SettingsProvider {
Expand Down Expand Up @@ -362,7 +362,7 @@ object PublicationSettings {
object Consts {
const val SLOW_TESTS_LOGGING_THRESHOLD_MS = 30_000L
const val MAX_TEST_RETRIES_COUNT = 3
const val MAX_SHA_LENGTH = 10
const val MAX_SHA_LENGTH = 8
}

object Tasks {
Expand Down

0 comments on commit 8e6411b

Please sign in to comment.