Skip to content

Commit

Permalink
Start setting up deployment through Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrepiveteau committed Apr 24, 2023
1 parent ee563df commit 3c76ba7
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 64 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build
on: [ push, pull_request, workflow_dispatch ]

env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/gradle-build-action@v2

- run: ./gradlew build check dokkaHtml

- run: ./gradlew publish
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'alexandrepiveteau/kotlin-graphs' }}
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}

- name: Deploy docs
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'alexandrepiveteau/kotlin-graphs' }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
cd build/dokka/html
git init . && git branch -m dokka
git add .
git config user.name "${{github.actor}}"
git config user.email "${{github.actor}}@users.noreply.github.com"
git commit -m "🚀 Publish documentation"
git remote add origin https://x-access-token:[email protected]/${{github.repository}}
git push -u origin dokka --force
29 changes: 0 additions & 29 deletions .github/workflows/dokka.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/gradle-wrapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: gradle-wrapper

on:
pull_request:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/'

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
13 changes: 0 additions & 13 deletions .github/workflows/tests.yml

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Change Log

## [Unreleased]

## [0.1.0] - 2023-04-24

Initial release


[Unreleased]: https://github.com/cashapp/turbine/compare/0.1.0...HEAD
[0.1.0]: https://github.com/alexandrepiveteau/kotlin-graphs/releases/tag/0.1.0
41 changes: 41 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Releasing

1. Update the `VERSION_NAME` in `gradle.properties` to the release version.

2. Update the `CHANGELOG.md`:
1. Change the `Unreleased` header to the release version.
2. Add a link URL to ensure the header link works.
3. Add a new `Unreleased` section to the top.

3. Update the `README.md` so the "Download" section reflects the new release
version and the snapshot section reflects the next "SNAPSHOT" version.

4. Commit

```
$ git commit -am "Prepare version X.Y.Z"
```

5. Tag

```
$ git tag -am "Version X.Y.Z" X.Y.Z
```

6. Update the `VERSION_NAME` in `gradle.properties` to the next "SNAPSHOT"
version.

7. Commit

```
$ git commit -am "Prepare next development version"
```

8. Push!

```
$ git push && git push --tags
```

This will trigger a GitHub Action workflow which will create a GitHub release
and upload the release artifacts to Maven Central.
35 changes: 15 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("multiplatform") version "1.8.20"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.0"
id("org.jetbrains.dokka") version "1.8.10"
id("com.vanniktech.maven.publish") version "0.25.2"
}

repositories { mavenCentral() }

kotlin {
explicitApi()
jvm()

js(IR) {
browser()
nodejs()
browser()
}
ios()
macosArm64()
macosX64()
linuxArm64()

jvm { compilations.configureEach { compilerOptions.options.jvmTarget.set(JvmTarget.JVM_1_8) } }

iosArm64()
iosX64()
iosSimulatorArm64()
linuxX64()
macosX64()
macosArm64()
mingwX64()

sourceSets {
val commonMain by getting { dependencies { implementation(kotlin("stdlib-common")) } }
val commonTest by getting { dependencies { implementation(kotlin("test")) } }
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting
val iosMain by getting
val iosTest by getting
val macosArm64Main by getting
val macosArm64Test by getting
val macosX64Main by getting
val macosX64Test by getting
val linuxArm64Main by getting
val linuxArm64Test by getting
val linuxX64Main by getting
val linuxX64Test by getting
all { languageSettings.optIn("kotlin.contracts.ExperimentalContracts") }
}
}
Expand Down
27 changes: 26 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
kotlin.code.style=official
GROUP=io.github.alexandrepiveteau
POM_ARTIFACT_ID=kotlin-graphs
# HEY! If you change the major version here be sure to update release.yaml doc
# target folder!
VERSION_NAME=0.1.0-SNAPSHOT
# Sonatype setup.
SONATYPE_AUTOMATIC_RELEASE=true
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
# POM Metadata
POM_NAME=kotlin-graphs
POM_DESCRIPTION=Model directed, undirected, weighted and unweighted graphs \
and perform computations on them in Kotlin multiplatform.
POM_INCEPTION_YEAR=2023
POM_URL=https://github.com/alexandrepiveteau/kotlin-graphs/
POM_SCM_URL=https://github.com/alexandrepiveteau/kotlin-graphs/
POM_SCM_CONNECTION=scm:git:git://github.com/alexandrepiveteau/kotlin-graphs.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com/alexandrepiveteau/kotlin-graphs.git
POM_LICENCE_NAME=The MIT License (MIT)
POM_LICENCE_URL=https://opensource.org/license/mit/
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=alexandrepiveteau
POM_DEVELOPER_NAME=Alexandre Piveteau
POM_DEVELOPER_URL=https://github.com/alexandrepiveteau/
kotlin.js.compiler=ir
kotlin.mpp.stability.nowarn=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 3c76ba7

Please sign in to comment.