Skip to content

Commit 5ebca0f

Browse files
committed
add release pipeline
Signed-off-by: Adam Ratzman <[email protected]>
1 parent 3c58d14 commit 5ebca0f

File tree

5 files changed

+88
-41
lines changed

5 files changed

+88
-41
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,40 +52,6 @@ jobs:
5252
name: code-coverage-report
5353
path: build/reports
5454
if: always()
55-
test_ios:
56-
runs-on: macos-latest
57-
environment: testing
58-
env:
59-
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
60-
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
61-
steps:
62-
- name: Check out repo
63-
uses: actions/checkout@v2
64-
- name: Test ios
65-
run: gradle iosX64Test
66-
- name: Archive test results
67-
uses: actions/upload-artifact@v2
68-
with:
69-
name: code-coverage-report
70-
path: build/reports
71-
if: always()
72-
test_tvos:
73-
runs-on: macos-latest
74-
environment: testing
75-
env:
76-
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
77-
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
78-
steps:
79-
- name: Check out repo
80-
uses: actions/checkout@v2
81-
- name: Test tvos
82-
run: gradle tvosX64Test
83-
- name: Archive test results
84-
uses: actions/upload-artifact@v2
85-
with:
86-
name: code-coverage-report
87-
path: build/reports
88-
if: always()
8955
test_windows:
9056
runs-on: windows-latest
9157
environment: testing

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Deployment workflow
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release_version:
6+
description: 'Semantic version number to release'
7+
required: true
8+
spotify_test_client_token:
9+
description: 'Spotify client redirect token (for client tests before release)'
10+
required: true
11+
spotify_test_redirect_uri:
12+
description: 'Spotify redirect uri'
13+
required: true
14+
env:
15+
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
16+
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
17+
SPOTIFY_TOKEN_STRING: ${{ event.inputs.spotify_test_client_token }}
18+
SPOTIFY_REDIRECT_URI: ${{ event.inputs.spotify_test_redirect_uri }}
19+
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
20+
ORG_GRADLE_PROJECT_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
21+
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
22+
ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
23+
SPOTIFY_API_PUBLISH_VERSION: ${{ event.inputs.release_version }}
24+
jobs:
25+
release_android_jvm_linux:
26+
runs-on: ubuntu-latest
27+
environment: release
28+
steps:
29+
- name: Check out repo
30+
uses: actions/checkout@v2
31+
- name: Install curl
32+
run: sudo apt-get install -y curl libcurl4-openssl-dev
33+
- name: Verify Android
34+
run: gradle testDebugUnitTest
35+
- name: Verify JVM
36+
run: gradle jvmTest
37+
- name: Publish JVM/Linux/Android
38+
run: gradle publishJvmPublicationToNexusRepository publishAndroidPublicationToNexusRepository publishLinuxX64PublicationToNexusRepository
39+
release_mac:
40+
runs-on: macos-latest
41+
environment: release
42+
steps:
43+
- name: Check out repo
44+
uses: actions/checkout@v2
45+
- name: Verify macOS
46+
run: gradle macosX64Test
47+
- name: Publish macOS/tvOS/iOS
48+
run: gradle publishMacosX64PublicationToNexusRepository publishIosX64PublicationToNexusRepository publishTvosX64PublicationToNexusRepository
49+
release_windows:
50+
runs-on: windows-latest
51+
environment: release
52+
steps:
53+
- name: Check out repo
54+
uses: actions/checkout@v2
55+
- name: Verify windows
56+
run: gradle mingwX64Test
57+
- name: Publish windows
58+
run: gradle publishMingwX64PublicationToNexusRepository
59+
release_docs:
60+
runs-on: windows-latest
61+
environment: release
62+
steps:
63+
- name: Check out repo
64+
uses: actions/checkout@v2
65+
- name: Build docs
66+
run: gradle dokkaHtml
67+
- name: Push docs to docs repo
68+
uses: cpina/github-action-push-to-another-repository@main
69+
env:
70+
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
71+
with:
72+
source-directory: 'build'
73+
destination-github-username: 'adamint'
74+
destination-repository-name: 'spotify-web-api-kotlin-docs'
75+
user-email: [email protected]
76+
target-branch: main

build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ publishing {
402402
}
403403

404404
signing {
405-
if (project.hasProperty("signing_key_id")
406-
&& project.hasProperty("signing_key_password")
405+
if (project.hasProperty("SIGNING_KEY")
406+
&& project.hasProperty("SIGNING_KEY_PASSWORD")
407407
) {
408408
useInMemoryPgpKeys(
409-
project.property("signing_key_id") as? String,
410-
project.property("signing_key_password") as? String
409+
project.findProperty("SIGNING_KEY") as? String,
410+
project.findProperty("SIGNING_KEY_PASSWORD") as? String
411411
)
412412
sign(publishing.publications)
413413
}
@@ -530,8 +530,8 @@ fun PublishingExtension.registerPublishing() {
530530
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
531531

532532
credentials {
533-
val nexusUsername: String? by project
534-
val nexusPassword: String? by project
533+
val nexusUsername: String? = project.findProperty("NEXUS_USERNAME") as? String
534+
val nexusPassword: String? = project.findProperty("NEXUS_PASSWORD") as? String
535535
username = nexusUsername
536536
password = nexusPassword
537537
}

src/commonTest/kotlin/com.adamratzman/spotify/pub/PublicArtistsApiTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ class PublicArtistsApiTest : AbstractTest<GenericSpotifyApi>() {
1818
@Test
1919
fun testGetArtists() {
2020
return runBlockingTest {
21+
println("here")
2122
super.build<GenericSpotifyApi>()
23+
println("here2")
24+
println(api)
2225
if (!testPrereq()) return@runBlockingTest else api!!
26+
println("here3")
2327
assertNull(api!!.artists.getArtist("adkjlasdf"))
2428
assertNotNull(api!!.artists.getArtist("66CXWjxzNUsdJxJ2JdwvnR"))
2529
assertFailsWith<SpotifyException.BadRequestException> { api!!.artists.getArtists() }

src/nativeDarwinTest/kotlin/com.adamratzman.spotify/CommonImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import kotlinx.coroutines.runBlocking
99
import platform.posix.getenv
1010

1111
actual fun getEnvironmentVariable(name: String): String? {
12-
return getenv(name)?.toKString()
12+
return getenv(name)?.toKString().apply { println("env variable $name: $this") }
1313
}
1414

1515
actual fun Exception.stackTrace() = printStackTrace()
1616

17+
val testCoroutineContext: CoroutineContext = MainScope().coroutineContext
1718
actual fun runBlockingTest(block: suspend CoroutineScope.() -> Unit) =
1819
runBlocking { block() }

0 commit comments

Comments
 (0)