Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 8bf1361

Browse files
authored
Merge pull request #15 from snyk/feat/sonatype-production-releases
feat: add deployment to maven central
2 parents 046c8fc + c101531 commit 8bf1361

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
name: Release to OSSRH Sonatype
22
on:
33
push:
4-
branches:
5-
- develop
6-
- master
4+
tags:
5+
- 'v*'
76

87
jobs:
98
gradle-wrapper-validation:
109
name: Validate Gradle Wrapper
1110
runs-on: ubuntu-latest
12-
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
1311
steps:
1412
- name: Fetch sources
1513
uses: actions/checkout@v2
1614

1715
- name: Validate Gradle Wrapper
1816
uses: gradle/wrapper-validation-action@v1
1917

20-
release-snapshot:
21-
name: Release snapshot version
18+
release:
19+
name: Release to Sonatype OSSRH
2220
needs: gradle-wrapper-validation
2321
runs-on: ubuntu-latest
24-
if: github.ref == 'refs/heads/develop'
2522
steps:
2623
- name: Fetch sources
2724
uses: actions/checkout@v2
@@ -45,13 +42,14 @@ jobs:
4542
echo "${{secrets.SIGNING_SECRET_KEY_RING_CONTENT}}" | base64 -d > ringkey.gpg
4643
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SECRET_PASSPHRASE}}" --output secring.gpg ringkey.gpg
4744
48-
- name: Release Deployment to Snapshot Repository
45+
- name: Release to OSSRH Staging repository
4946
run: |
5047
./gradlew publish -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} \
5148
-Psigning.password=${{secrets.SIGNING_PASSWORD}} \
5249
-Psigning.secretKeyRingFile=secring.gpg \
5350
-PossrhUsername=${{secrets.OSSRH_USERNAME}} \
54-
-PossrhPassword=${{secrets.OSSRH_PASSWORD}}
51+
-PossrhPassword=${{secrets.OSSRH_PASSWORD}} \
52+
-Prelease
5553
5654
- name: Post Setting GPG key
5755
run: rm -rf *.gpg

build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ plugins {
66

77
group = "io.snyk.code.sdk"
88
archivesBaseName = "snyk-code-client"
9-
version = "2.1.6-SNAPSHOT"
10-
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
9+
version = "2.1.6"
1110

1211
repositories {
1312
mavenCentral()
@@ -66,9 +65,7 @@ integTest.dependsOn test
6665
publishing {
6766
repositories {
6867
maven {
69-
def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
70-
def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
71-
url = isReleaseVersion ? releaseRepo : snapshotRepo
68+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
7269
credentials {
7370
username = project.hasProperty("ossrhUsername") ? ossrhUsername : "Unknown user"
7471
password = project.hasProperty("ossrhPassword") ? ossrhPassword : "Unknown password"
@@ -109,5 +106,5 @@ signing {
109106
sign publishing.publications.maven
110107
}
111108
tasks.withType(Sign) {
112-
onlyIf { isReleaseVersion }
109+
onlyIf { project.hasProperty("release") }
113110
}

0 commit comments

Comments
 (0)