Skip to content

Commit 93a6216

Browse files
kittinunfiNoles
andauthored
[Publish] Add github action for publish to maven (#852)
* 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 <iNoles@users.noreply.github.com>
1 parent 2f784a5 commit 93a6216

File tree

10 files changed

+244
-137
lines changed

10 files changed

+244
-137
lines changed

.github/workflows/gradle-build-main.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Gradle Push
2+
on:
3+
push:
4+
branches: [ main ]
5+
6+
jobs:
7+
gradle:
8+
runs-on: macos-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-java@v3
12+
with:
13+
distribution: temurin
14+
java-version: 8
15+
16+
- name: Gradle build
17+
uses: gradle/gradle-build-action@v2
18+
with:
19+
arguments: build
20+
21+
- name: Publish to SNAPSHOT
22+
uses: gradle/gradle-build-action@v2
23+
env:
24+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
25+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
26+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
27+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
28+
with:
29+
arguments: publishAllPublicationsToSonatypeRepository --max-workers 1
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ jobs:
1111
distribution: temurin
1212
java-version: 8
1313

14-
- name: Setup Gradle
14+
- name: Gradle build
1515
uses: gradle/gradle-build-action@v2
16-
17-
- name: Execute Gradle build
18-
run: ./gradlew build
16+
with:
17+
arguments: build

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Gradle Push
2+
on:
3+
release:
4+
types: [ released ]
5+
6+
jobs:
7+
gradle:
8+
runs-on: macos-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-java@v3
12+
with:
13+
distribution: temurin
14+
java-version: 8
15+
16+
- name: Gradle build
17+
uses: gradle/gradle-build-action@v2
18+
with:
19+
arguments: build
20+
21+
- name: Publish to MavenCentral
22+
uses: gradle/gradle-build-action@v2
23+
env:
24+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
25+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
26+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
27+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
28+
with:
29+
arguments: publish --max-workers 1 -Prelease=true

build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ plugins {
22
kotlin("multiplatform") version "1.8.10" apply false
33
}
44

5+
val isReleaseBuild: Boolean
6+
get() = properties.containsKey("release")
7+
58
allprojects {
69
repositories {
710
mavenCentral()
811
}
912
val artifactPublishVersion: String by project
1013
val artifactGroupId: String by project
1114
group = artifactGroupId
12-
version = artifactPublishVersion
15+
version = if (isReleaseBuild) artifactPublishVersion else "main-SNAPSHOT"
1316
}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
kotlin.code.style=official
22
kotlin.js.generate.executable.default=false
33

4+
# Keep in sync with other projects
5+
# Give more memory to the Gradle daemon
6+
org.gradle.jvmargs=-Xmx4g
7+
48
artifactName=Fuel
59
artifactDesc=The easiest HTTP networking library for Kotlin/Android
610
artifactUrl=https://github.com/kittinunf/fuel

gradle/wrapper/gradle-wrapper.jar

2.32 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)