Skip to content

Commit

Permalink
[Publish] Add github action for publish to maven (#852)
Browse files Browse the repository at this point in the history
* Add github action to publish

* Update version gradle

* Update version for fuel

* Update gradle and wrapper

* Maybe we don't have to setup gradle alone

* Update pr.yml

* Update gradle.properties to increase memory

* put back PR where Kittinunf had before

* Update pr.yml

---------

Co-authored-by: Jonathan <[email protected]>
  • Loading branch information
kittinunf and iNoles authored Apr 2, 2023
1 parent 2f784a5 commit 93a6216
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 137 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/gradle-build-main.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run Gradle Push
on:
push:
branches: [ main ]

jobs:
gradle:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8

- name: Gradle build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Publish to SNAPSHOT
uses: gradle/gradle-build-action@v2
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
with:
arguments: publishAllPublicationsToSonatypeRepository --max-workers 1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:
distribution: temurin
java-version: 8

- name: Setup Gradle
- name: Gradle build
uses: gradle/gradle-build-action@v2

- name: Execute Gradle build
run: ./gradlew build
with:
arguments: build
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run Gradle Push
on:
release:
types: [ released ]

jobs:
gradle:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8

- name: Gradle build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Publish to MavenCentral
uses: gradle/gradle-build-action@v2
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
with:
arguments: publish --max-workers 1 -Prelease=true
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ plugins {
kotlin("multiplatform") version "1.8.10" apply false
}

val isReleaseBuild: Boolean
get() = properties.containsKey("release")

allprojects {
repositories {
mavenCentral()
}
val artifactPublishVersion: String by project
val artifactGroupId: String by project
group = artifactGroupId
version = artifactPublishVersion
version = if (isReleaseBuild) artifactPublishVersion else "main-SNAPSHOT"
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
kotlin.code.style=official
kotlin.js.generate.executable.default=false

# Keep in sync with other projects
# Give more memory to the Gradle daemon
org.gradle.jvmargs=-Xmx4g

artifactName=Fuel
artifactDesc=The easiest HTTP networking library for Kotlin/Android
artifactUrl=https://github.com/kittinunf/fuel
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 93a6216

Please sign in to comment.