Skip to content

Commit

Permalink
Fixes for release process (#25)
Browse files Browse the repository at this point in the history
### What's done:
- changed workflow scripts
- updated publishing configuration
  • Loading branch information
orchestr7 authored May 11, 2021
1 parent 5a010ac commit b100be5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 44 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
67 changes: 34 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand All @@ -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
Expand All @@ -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/[email protected]
- 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/[email protected]
- 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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
arguments: publishToSonatype closeSonatypeStagingRepository
gradle-version: wrapper
asset_paths: '["./tmpFolder/save*"]'
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin

fun Project.configurePublishing() {
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
apply<NexusPublishPlugin>()

// If present, set properties from env variables. If any are absent, release will fail.
System.getenv("OSSRH_USERNAME")?.let {
extra.set("sonatypeUsername", it)
Expand All @@ -32,17 +28,23 @@ fun Project.configurePublishing() {
extra.set("signingPassword", it)
}

if (this == rootProject) {
apply<NexusPublishPlugin>()
if (hasProperty("sonatypeUsername")) {
configureNexusPublishing()
}
}

apply<MavenPublishPlugin>()
apply<SigningPlugin>()

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")
Expand Down Expand Up @@ -124,4 +126,4 @@ private fun Project.configureNexusPublishing() {
}
}
}
}
}

0 comments on commit b100be5

Please sign in to comment.