GeezerVison is showing github.com — ci: automate release creation and artifact uploading (#6) · testlens-app/cli@ee0e741
File tree
Expand file treeCollapse file tree
Open diff view settings
gradle/plugins/src/main/kotlin src/test/java/app/testlens/cli
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +69Lines changed: 69 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + |
| 9 | +permissions: {} |
| 10 | + |
| 11 | +jobs: |
| 12 | + graalvm: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: |
| 16 | + - runner: ubuntu |
| 17 | + label: linux |
| 18 | + - runner: macos |
| 19 | + label: macos |
| 20 | + - runner: windows |
| 21 | + label: windows |
| 22 | + fail-fast: false |
| 23 | + runs-on: ${{ matrix.os.runner }}-latest |
| 24 | + name: GraalVM Native Image (${{ matrix.os.label }}) |
| 25 | + steps: |
| 26 | + - name: standardize git line endings |
| 27 | + run: | |
| 28 | + git config --global core.autocrlf false |
| 29 | + git config --global core.eol lf |
| 30 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 31 | + with: |
| 32 | + fetch-depth: 1 |
| 33 | + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 |
| 34 | + with: |
| 35 | + distribution: graalvm |
| 36 | + java-version-file: gradle/java-version.txt |
| 37 | + - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 |
| 38 | + with: |
| 39 | + build-scan-terms-of-use-url: https://gradle.com/terms-of-service |
| 40 | + build-scan-terms-of-use-agree: yes |
| 41 | + - uses: testlens-app/setup-testlens@d29a2be31512b3aeda3adcef09fbe0d55af90c51 # v1.9.4 |
| 42 | + - run: ./gradlew signReleaseArchive |
| 43 | + env: |
| 44 | + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} |
| 45 | + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} |
| 46 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 47 | + with: |
| 48 | + name: testlens-${{ matrix.os.label }} |
| 49 | + path: build/release/** |
| 50 | + if-no-files-found: error |
| 51 | + |
| 52 | + create_release: |
| 53 | + needs: graalvm |
| 54 | + name: Create GitHub release |
| 55 | + runs-on: ubuntu-latest |
| 56 | + permissions: |
| 57 | + contents: write |
| 58 | + steps: |
| 59 | + |
| 60 | + with: |
| 61 | + pattern: testlens-* |
| 62 | + merge-multiple: true |
| 63 | + - run: ls -alR |
| 64 | + - uses: softprops/action-gh-release@v3 |
| 65 | + with: |
| 66 | + generate_release_notes: true |
| 67 | + draft: true |
| 68 | + make_latest: true |
| 69 | + files: testlens-* |
Collapse file
Copy file name to clipboardExpand all lines: build.gradle.kts +13-1Lines changed: 13 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,19 @@ plugins { |
2 | 2 | id("app.testlens.gradle.component.application-cli") |
3 | 3 | } |
4 | 4 |
|
5 | | -version = "0.1.0" |
| 5 | +/** |
| 6 | + * Releasing: |
| 7 | + * 1. Change the version to the version that you want to release |
| 8 | + * 2. Commit the change, but don't push yet |
| 9 | + * - commit message: "chore: release 1.x.x" |
| 10 | + * 3. Tag the commit as `v<version>` where `<version>` is the version you want to release |
| 11 | + * - run: git tag -s v1.x.x -m v1.x.x |
| 12 | + * 3. Change the version to the next development SNAPSHOT version |
| 13 | + * 4. Commit the change: |
| 14 | + * - commit message: "chore: use next snapshot version" |
| 15 | + * 5. Push everything by running `git push --follow-tags` |
| 16 | + */ |
| 17 | +version = "1.0.0-SNAPSHOT" |
6 | 18 |
|
7 | 19 | dependencies { |
8 | 20 | implementation(libs.diffUtils) |
|
Collapse file
Copy file name to clipboardExpand all lines: gradle/plugins/src/main/kotlin/app.testlens.gradle.component.application-cli.gradle.kts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,7 @@ plugins { |
14 | 14 | id("app.testlens.gradle.check.format-java") |
15 | 15 | id("app.testlens.gradle.check.javac-lint") |
16 | 16 | id("app.testlens.gradle.feature.java-compile") |
| 17 | + id("app.testlens.gradle.feature.release") |
17 | 18 | id("app.testlens.gradle.feature.test") |
18 | 19 | id("application") |
19 | 20 | id("org.openapi.generator") |
|
Collapse file
Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import org.gradle.internal.os.OperatingSystem |
| 2 | + |
| 3 | +plugins { |
| 4 | + signing |
| 5 | + id("org.graalvm.buildtools.native") |
| 6 | +} |
| 7 | + |
| 8 | +val assembleReleaseArchive = tasks.register<Zip>("assembleReleaseArchive") { |
| 9 | + from(tasks.named("nativeCompile")) |
| 10 | + into(provider { "testlens-${version}" }) |
| 11 | + destinationDirectory = project.layout.buildDirectory.dir("release") |
| 12 | + val os = OperatingSystem.current() |
| 13 | + val osName = when { |
| 14 | + os.isLinux -> "linux" |
| 15 | + os.isMacOsX -> "macos" |
| 16 | + os.isWindows -> "windows" |
| 17 | + else -> error("Unsupported OS: $os") |
| 18 | + } |
| 19 | + archiveBaseName = "testlens-$osName" |
| 20 | +} |
| 21 | + |
| 22 | +signing { |
| 23 | + useInMemoryPgpKeys( |
| 24 | + providers.environmentVariable("SIGNING_KEY").orNull, |
| 25 | + providers.environmentVariable("SIGNING_PASSPHRASE").orNull, |
| 26 | + ) |
| 27 | +} |
| 28 | + |
| 29 | +tasks.register<Sign>("signReleaseArchive") { |
| 30 | + sign(assembleReleaseArchive.get()) |
| 31 | +} |
Collapse file
Copy file name to clipboardExpand all lines: src/test/java/app/testlens/cli/VersionTest.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ void printsVersion() { |
13 | 13 | var result = run("--version"); |
14 | 14 |
|
15 | 15 | assertThat(result.exitCode()).isZero(); |
16 | | - assertThat(result.stdout().trim()).matches("\\d+(\\.\\d+)+"); |
| 16 | + assertThat(result.stdout().trim()).matches("\\d+(\\.\\d+)+(-SNAPSHOT)?"); |
17 | 17 | assertThat(result.stderr()).isEmpty(); |
18 | 18 | } |
19 | 19 | } |