diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e84b8ac3..33a2c0fa 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -9,7 +9,10 @@ on: jobs: build_and_test_with_code_coverage: name: Build and test - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] steps: # actions/checkout v1.* is needed for correct codecov upload, see https://github.com/actions/checkout/issues/237 for details @@ -43,9 +46,10 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v2 with: - name: gradle-reports + name: gradle-reports-${{ matrix.os }} path: '**/build/reports/' - name: Code coverage report + #if: ${{ runner.os == 'Linux' }} if: ${{ false }} uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97c5e576..274759bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,12 @@ env: OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} jobs: - release_linux: - name: Build release on main platform (Linux) - runs-on: ubuntu-20.04 + release: + name: Build release + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] #, macos-latest ] steps: - name: Checkout uses: actions/checkout@v2.3.3 @@ -24,8 +27,28 @@ jobs: - uses: burrunan/gradle-cache-action@v1 name: Gradle release with caches caching with: - arguments: publishToSonatype closeSonatypeStagingRepository + arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository gradle-version: wrapper + - name: Upload artifact + id: upload_artifact + uses: actions/upload-artifact@v2 + with: + name: save-cli-${{ runner.os }} + path: save-cli/build/bin/**/releaseExecutable/* + + + github_release: + + needs: release + name: Create Github Release + runs-on: ubuntu-latest + steps: + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + path: tmpFolder + - name: Create Github Release id: create_release uses: actions/create-release@v1 @@ -36,33 +59,11 @@ jobs: release_name: Release ${{ github.ref }} draft: false prerelease: false - release_macos: - name: Build release on MacOS - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - uses: burrunan/gradle-cache-action@v1 - name: Gradle release with caches caching - with: - arguments: publishToSonatype closeSonatypeStagingRepository - gradle-version: wrapper - release_windows: - name: Build release on Windows - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v2.3.3 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - uses: burrunan/gradle-cache-action@v1 - name: Gradle release with caches caching + + - name: Upload save-cli + id: upload-release-asset + uses: alexellis/upload-assets@0.3.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - arguments: publishToSonatype closeSonatypeStagingRepository - gradle-version: wrapper \ No newline at end of file + asset_paths: '["./tmpFolder/save*"]' diff --git a/buildSrc/src/main/kotlin/com.akuleshov7/buildutils/PublishingConfiguration.kt b/buildSrc/src/main/kotlin/com.akuleshov7/buildutils/PublishingConfiguration.kt index 537c5e79..c10bee10 100644 --- a/buildSrc/src/main/kotlin/com.akuleshov7/buildutils/PublishingConfiguration.kt +++ b/buildSrc/src/main/kotlin/com.akuleshov7/buildutils/PublishingConfiguration.kt @@ -14,10 +14,6 @@ import org.gradle.plugins.signing.SigningExtension import org.gradle.plugins.signing.SigningPlugin fun Project.configurePublishing() { - apply() - apply() - apply() - // If present, set properties from env variables. If any are absent, release will fail. System.getenv("OSSRH_USERNAME")?.let { extra.set("sonatypeUsername", it) @@ -32,17 +28,23 @@ fun Project.configurePublishing() { extra.set("signingPassword", it) } + if (this == rootProject) { + apply() + if (hasProperty("sonatypeUsername")) { + configureNexusPublishing() + } + } + + apply() + apply() + configurePublications() if (hasProperty("signingKey")) { configureSigning() } - if (hasProperty("sonatypeUsername")) { - configureNexusPublishing() - } // https://kotlinlang.org/docs/mpp-publish-lib.html#avoid-duplicate-publications - // Publication with name `kotlinMultiplatform` is for the default artifact. // `configureNexusPublishing` adds sonatype publication tasks inside `afterEvaluate`. rootProject.afterEvaluate { val publicationsFromMainHost = listOf("jvm", "js", "linuxX64", "kotlinMultiplatform", "metadata") @@ -124,4 +126,4 @@ private fun Project.configureNexusPublishing() { } } } -} \ No newline at end of file +}