Skip to content

Commit

Permalink
add publish snapshot workflow (#2)
Browse files Browse the repository at this point in the history
* add publish snapshot workflow

* add test file to check snapshot overrides

* add readme and snapshot publish

* add release flag
  • Loading branch information
MarvinSchramm authored Mar 1, 2021
1 parent 708882c commit 1551db7
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 9 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/hndrs-gradle-publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: gradle

# Controls when the action will run.
on:
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
publish-snapshot:
runs-on: ubuntu-latest

steps:
- name: git checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: setup java
uses: actions/setup-java@v1
with:
java-version: '11'

- name: setup build cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: publish
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
run: |
./gradlew publish
2 changes: 1 addition & 1 deletion .github/workflows/hndrs-gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: |
./gradlew publish
./gradlew -Prelease publish
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,26 @@ open class ExampleReceiver : StripeEventReceiver<Subscription>(Subscription::cla
}
```

> The ```StripeEventReceiver``` generic needs to be subclass of a [StripeObject](https://github.com/stripe/stripe-java/blob/master/src/main/java/com/stripe/model/StripeObject.java)
> The ```StripeEventReceiver``` generic needs to be subclass of a [StripeObject](https://github.com/stripe/stripe-java/blob/master/src/main/java/com/stripe/model/StripeObject.java)
#### Accessing Snapshots

To access [snapshot builds](https://github.com/hndrs/stripe-spring-boot-starter/packages) add the following to your
gradle script

```kotlin
maven {
url = uri("https://maven.pkg.github.com/hndrs/stripe-spring-boot-starter")
credentials {
username = "<GITHUB_USERNAME>"
password = "<PERSONAL_ACCESS_TOKEN"
}
}

dependencies {
implementation(group = "io.hndrs", name = "stripe-spring-boot-starter", version = "1.0.0-SNAPSHOT")
}

```

> Your personal access token needs the read:packages scope (Download packages from GitHub Package Registry)
29 changes: 22 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ plugins {
id("io.hndrs.publishing-info").version("1.1.0").apply(false)
}

val isRelease = project.hasProperty("release")

group = "io.hndrs"
version = "1.0.0-1"
version = "1.0.0".plus(if (isRelease) "" else "-SNAPSHOT")
java.sourceCompatibility = JavaVersion.VERSION_11


Expand Down Expand Up @@ -101,14 +103,27 @@ subprojects {

publishing {
repositories {
maven {
name = "release"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
if (isRelease) {
maven {
name = "release"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
}
} else {
maven {
name = "snapshot"
url = uri("https://maven.pkg.github.com/hndrs/stripe-spring-boot-starter")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}


}

}
Expand Down

0 comments on commit 1551db7

Please sign in to comment.