-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clean up build scripts and release action
- Loading branch information
1 parent
1f4fabe
commit ee8c1be
Showing
5 changed files
with
90 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Release SDK to Maven Central | ||
name: Release SDK | ||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -10,54 +10,40 @@ on: | |
required: true | ||
|
||
jobs: | ||
build: | ||
release-code: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: gradle/actions/wrapper-validation@v3 | ||
|
||
- uses: actions/setup-java@v4 | ||
- name: Set up Java 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
distribution: 'temurin' | ||
server-id: oss-sonatype | ||
server-username: SONATYPE_USERNAME | ||
server-password: SONATYPE_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Prepare Environment and Version | ||
id: prepare | ||
run: | | ||
git config user.name s-github-actions | ||
git config user.email [email protected] | ||
echo "branch_name=release/${{ inputs.version }}" >> $GITHUB_OUTPUT | ||
- name: Build library with Gradle | ||
run: ./gradlew clean build | ||
|
||
- name: Prepare Release | ||
id: prepare_release | ||
- name: Publish library with Gradle | ||
run: | | ||
cd code | ||
chmod a+x ../gradlew && ../gradlew --no-daemon versionsSet -Pversion=${{ inputs.version }} | ||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
branch: "publish-v${{ inputs.version }}" | ||
commit-message: "chore: prepare release ${{ inputs.version }}" | ||
title: "chore: Publish v${{ inputs.version }}" | ||
body: | | ||
This PR publishes the source code for `v${{ inputs.version }}`. | ||
Generated by the EG SDK generator. | ||
add-paths: | | ||
code/* | ||
- name: Build and Publish | ||
echo "New version: ${{ inputs.version }}" | ||
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository publishPlugins -Pversion=${{ inputs.version }} | ||
env: | ||
ARTYLAB_USER: ${{ secrets.SONATYPE_USERNAME }} | ||
ARTYLAB_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
GPG_SECRET: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} | ||
run: | | ||
echo "Publishing version ${{ inputs.version }}" | ||
cd code | ||
../gradlew --no-daemon clean jar build publish -Pversion=${{ inputs.version }} | ||
PLUGIN_PORTAL_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
PLUGIN_PORTAL_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
|
||
- name: Archive failure build reports | ||
uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: build-reports | ||
path: | | ||
./**/build/reports | ||
retention-days: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import java.time.Duration | ||
|
||
plugins { | ||
id 'org.jetbrains.kotlin.jvm' version '2.0.20' | ||
id 'io.github.gradle-nexus.publish-plugin' version "1.1.0" | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} | ||
|
||
compileJava { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
allprojects { | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
mavenLocal { | ||
content { | ||
includeGroup("com.expediagroup") | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal { | ||
content { | ||
includeGroup("com.expediagroup") | ||
} | ||
} | ||
} | ||
} | ||
|
||
subprojects { | ||
if (project.name != "examples") { | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
username.set(System.getenv("SONATYPE_USERNAME")) | ||
password.set(System.getenv("SONATYPE_PASSWORD")) | ||
} | ||
} | ||
|
||
transitionCheckOptions { | ||
maxRetries.set(60) | ||
delayBetween.set(Duration.ofMillis(5000)) | ||
} | ||
} | ||
} | ||
|
||
if (project.name == 'examples') { | ||
tasks.withType(Jar).configureEach { | ||
enabled = false | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
kotlin.code.style=official | ||
groupId=com.expediagroup | ||
version=1.0.2-SNAPSHOT | ||
version=0.0.1-SNAPSHOT | ||
description=SDK for Lodging Connectivity APIs |