Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging publishing #25

Merged
merged 12 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 45 additions & 10 deletions .github/workflows/sdk_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,48 @@ on:
workflow_dispatch: {}
jobs:
publish:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
with:
target: my-first-target
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
java_gpg_passphrase: ${{ secrets.JAVA_GPG_PASSPHRASE }}
java_gpg_secret_key: ${{ secrets.JAVA_GPG_SECRET_KEY }}
ossrh_password: ${{ secrets.OSSRH_PASSWORD }}
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
runs-on: ubuntu-latest
env:
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
cache: 'gradle'

- name: Verify Config
run: |
./gradlew jreleaserConfig

- name: Clean & Build Project
run: |
./gradlew clean build --no-daemon

- name: Stage Artifact
run: |
./gradlew publish --no-daemon

- name: Dry Run
run: |
./gradlew jreleaserFullRelease --dry-run

- name: Full Release
run: |
./gradlew jreleaserFullRelease --no-daemon

- name: Check Status
run: |
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "Error occurred during publishing"
exit $STATUS
fi
2 changes: 1 addition & 1 deletion .github/workflows/sdk_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up java
- name: Set up JDK
id: setup_java
uses: actions/setup-java@v4
with:
Expand Down
1,121 changes: 571 additions & 550 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
java:
version: 1.0.0-beta.5
version: 1.0.0-beta
additionalDependencies: []
additionalPlugins:
- id 'groovy'
artifactID: shippoSDK
- id 'org.jreleaser' version '1.15.0'
artifactID: shippo-sdk
clientServerStatusCodesAsErrors: true
companyEmail: [email protected]
companyName: Shippo
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
speakeasyVersion: 1.447.2
speakeasyVersion: 1.448.2
sources:
my-first-source:
sourceNamespace: my-first-source
sourceRevisionDigest: sha256:030038a1fd1ba2c5e90a725e3c516861b549e455b264cca99da98f235bf0b32f
sourceBlobDigest: sha256:8c66d55b10c00886e8fd1f2b6ea6b233bccf17f622fed046dcf302d5da3f91f5
sourceRevisionDigest: sha256:480494c08f99f68cd119fdb481d81d31d37e4e22211cc6fd8a5197857b7580b4
sourceBlobDigest: sha256:422c969f0c8ded72f1dc9d756407a9d51740270b9d16fd9c4f4a9d50f4e714ba
tags:
- latest
- "2018-02-08"
targets:
my-first-target:
source: my-first-source
sourceNamespace: my-first-source
sourceRevisionDigest: sha256:030038a1fd1ba2c5e90a725e3c516861b549e455b264cca99da98f235bf0b32f
sourceBlobDigest: sha256:8c66d55b10c00886e8fd1f2b6ea6b233bccf17f622fed046dcf302d5da3f91f5
sourceRevisionDigest: sha256:480494c08f99f68cd119fdb481d81d31d37e4e22211cc6fd8a5197857b7580b4
sourceBlobDigest: sha256:422c969f0c8ded72f1dc9d756407a9d51740270b9d16fd9c4f4a9d50f4e714ba
codeSamplesNamespace: my-first-source-java-code-samples
codeSamplesRevisionDigest: sha256:ee4ad78b96b9cbba8da9e8a06576bfa9c5f3498d8b50dcce45185178f64eae09
codeSamplesRevisionDigest: sha256:2b960672ec02abfbb6692e804ee954c218ece797c765654fab7f71084709ef08
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand All @@ -30,7 +30,7 @@ workflow:
source: my-first-source
publish:
java:
ossrhUsername: lucas-shippo
ossrhUsername: $ossrh_username
ossrhPassword: $ossrh_password
gpgSecretKey: $java_gpg_secret_key
gpgPassPhrase: $java_gpg_passphrase
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ targets:
source: my-first-source
publish:
java:
ossrhUsername: lucas-shippo
ossrhUsername: $ossrh_username
ossrhPassword: $ossrh_password
gpgSecretKey: $java_gpg_secret_key
gpgPassPhrase: $java_gpg_passphrase
Expand Down
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ Shippo external API.: Use this API to integrate with the Shippo service

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [<img src="https://docs.goshippo.com/images/Logo.png" width="30" alt="Shippo logo"> Shippo Java SDK](#img-srchttpsdocsgoshippocomimageslogopng-width30-altshippo-logo-shippo-java-sdk)
* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Development](#development)
* [Maturity](#maturity)
* [Contributions](#contributions)
* [About Shippo](#about-shippo)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Authentication](#authentication)

* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Authentication](#authentication)
<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
Expand Down Expand Up @@ -79,8 +85,8 @@ gradlew.bat publishToMavenLocal -Pskip.signing
```java
package hello.world;

import com.goshippo.shippoSDK.Shippo;
import com.goshippo.shippoSDK.models.operations.ListAddressesResponse;
import com.goshippo.shippo_sdk.Shippo;
rkeur7 marked this conversation as resolved.
Show resolved Hide resolved
import com.goshippo.shippo_sdk.models.operations.ListAddressesResponse;

import java.lang.Exception;

Expand Down Expand Up @@ -283,11 +289,11 @@ By default, an API error will throw a `models/errors/SDKError` exception. When c
```java
package hello.world;

import com.goshippo.shippoSDK.Shippo;
import com.goshippo.shippoSDK.models.errors.InitiateOauth2SigninCarrierAccountsResponseBody;
import com.goshippo.shippoSDK.models.errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody;
import com.goshippo.shippoSDK.models.errors.InitiateOauth2SigninResponseBody;
import com.goshippo.shippoSDK.models.operations.InitiateOauth2SigninResponse;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseBody;
import com.goshippo.shippo_sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody;
import com.goshippo.shippo_sdk.models.errors.InitiateOauth2SigninResponseBody;
import com.goshippo.shippo_sdk.models.operations.InitiateOauth2SigninResponse;
import java.lang.Exception;

public class Application {
Expand Down Expand Up @@ -321,8 +327,8 @@ The default server can also be overridden globally using the `.serverURL(String
```java
package hello.world;

import com.goshippo.shippoSDK.Shippo;
import com.goshippo.shippoSDK.models.operations.ListAddressesResponse;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListAddressesResponse;
import java.lang.Exception;

public class Application {
Expand Down Expand Up @@ -364,8 +370,8 @@ To authenticate with the API the `apiKeyHeader` parameter must be set when initi
```java
package hello.world;

import com.goshippo.shippoSDK.Shippo;
import com.goshippo.shippoSDK.models.operations.ListAddressesResponse;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListAddressesResponse;
import java.lang.Exception;

public class Application {
Expand Down
4 changes: 2 additions & 2 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
```java
package hello.world;

import com.goshippo.shippoSDK.Shippo;
import com.goshippo.shippoSDK.models.operations.ListAddressesResponse;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListAddressesResponse;
import java.lang.Exception;

public class Application {
Expand Down
44 changes: 36 additions & 8 deletions build-extras.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
// * can be used to customise `build.gradle`
// * is generated once and not overwritten in SDK generation updates

// Disable tests for publishing b/c we run tests in pipeline already
// TODO: Find better alternative
tasks.named('test') {
onlyIf {
project.hasProperty('runTests')
}
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.9.2'
Expand All @@ -23,3 +15,39 @@ test {
events "passed", "skipped", "failed"
}
}
// Disable tests for publishing b/c we run tests in pipeline already
// TODO: Find better alternative
tasks.named('test') {
onlyIf {
project.hasProperty('runTests')
}
}

repositories {
maven {
url = layout.buildDirectory.dir('target/staging-deploy')
}
}

jreleaser {
signing {
active = 'ALWAYS'
armored = true
verify = false
passphrase = System.getenv("JRELEASER_GPG_PASSPHRASE")
secretKey = System.getenv("JRELEASER_GPG_SECRET_KEY")
}
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
username = System.getenv("JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_USERNAME")
password = System.getenv("JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_PASSWORD")
stagingRepository('target/staging-deploy')
}
}
}
}
}
22 changes: 11 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {
id 'maven-publish'
id 'signing'
id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3'
id 'groovy'
id 'org.jreleaser' version '1.15.0'
}

compileJava.options.encoding = "UTF-8"
Expand All @@ -42,9 +42,9 @@ model {

jar {
dependsOn(":generatePomFileForMavenPublication")
archiveBaseName = "shippoSDK"
archiveBaseName = "shippo-sdk"

into("META-INF/maven/com.goshippo/shippoSDK") {
into("META-INF/maven/com.goshippo/shippo-sdk") {
from("$buildDir/pom.xml")
}
}
Expand All @@ -64,14 +64,14 @@ tasks.withType(Javadoc) {
}

group = "com.goshippo"
version = "1.0.0-beta.5"
version = "1.0.0-beta"

sourcesJar {
archiveBaseName = "shippoSDK"
archiveBaseName = "shippo-sdk"
}

javadocJar {
archiveBaseName = "shippoSDK"
archiveBaseName = "shippo-sdk"
}
sonatypeCentralUpload {
// This is your Sonatype generated username
Expand All @@ -81,9 +81,9 @@ sonatypeCentralUpload {

// This is a list of files to upload. Ideally you would point to your jar file, source and javadoc jar (required by central)
archives = files(
"$buildDir/libs/shippoSDK-${version}.jar",
"$buildDir/libs/shippoSDK-${version}-sources.jar",
"$buildDir/libs/shippoSDK-${version}-javadoc.jar"
"$buildDir/libs/shippo-sdk-${version}.jar",
"$buildDir/libs/shippo-sdk-${version}-sources.jar",
"$buildDir/libs/shippo-sdk-${version}-javadoc.jar"
)

// This is the pom file to upload. This is required by central
Expand All @@ -101,8 +101,8 @@ publishing {
publications {
maven(MavenPublication) {
groupId = 'com.goshippo'
artifactId = 'shippoSDK'
version = '1.0.0-beta.5'
artifactId = 'shippo-sdk'
version = '1.0.0-beta'

from components.java

Expand Down
2 changes: 0 additions & 2 deletions docs/models/components/CarriersEnum.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
| new_zealand_post | New Zealand Post (also used for Pace and CourierPost)|
| nippon_express | Nippon Express|
| ontrac | OnTrac|
| orangeds | OrangeDS|
| parcelforce | Parcelforce|
| passport | Passport|
| pcf | PCF|
Expand Down Expand Up @@ -113,7 +112,6 @@
| `NEW_ZEALAND_POST` | new_zealand_post |
| `NIPPON_EXPRESS` | nippon_express |
| `ONTRAC` | ontrac |
| `ORANGEDS` | orangeds |
| `PARCELFORCE` | parcelforce |
| `PASSPORT` | passport |
| `PCF` | pcf |
Expand Down
Loading