From 598b4cf103730561d84f365650b852fc5463da74 Mon Sep 17 00:00:00 2001 From: Dan Van Atta Date: Wed, 5 Jun 2024 20:16:11 -0700 Subject: [PATCH] Leverage existing JAR publish of existing http-client subproject (#12620) This update unifies the newly added JAR publish config with the existing config. I did not realize we already published jars, hence the need to unify config that does about the same. Even better, the existing mechanism only publishes the 'http-client' JAR, which is exactly (and no more than) what we need for a server dependency. --- .github/workflows/publish-jar-file.yml | 33 ------------------- .github/workflows/upload-http-client-jars.yml | 15 +++++++-- game-app/game-headed/build.gradle | 19 ----------- http-clients/lobby-client/build.gradle | 6 ++-- 4 files changed, 14 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/publish-jar-file.yml diff --git a/.github/workflows/publish-jar-file.yml b/.github/workflows/publish-jar-file.yml deleted file mode 100644 index 3853729b8f..0000000000 --- a/.github/workflows/publish-jar-file.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Jar file is useful for server code, so that the server code can depend on -# the TripleA client code (jar file). The TripleA client should include -# the 'http client' (AKA REST API) code for communicating with server -name: Publish Jar File -on: - push: - branches: - - master -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -jobs: - build: - runs-on: Ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 -# with: -# # Fetch depth of 0 is needed so we checkout the full revision history -# # The current revision count will be used as our build-number -# fetch-depth: '0' - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 11 - - name: set build version variables - run: | - BUILD_VERSION=$(game-app/run/.build/get-build-version) - echo "JAR_VERSION=$BUILD_VERSION" | tee -a $GITHUB_ENV - - name: Publish package - run: ./gradlew :game-app:game-headed:publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/upload-http-client-jars.yml b/.github/workflows/upload-http-client-jars.yml index 3328f5897a..454355d673 100644 --- a/.github/workflows/upload-http-client-jars.yml +++ b/.github/workflows/upload-http-client-jars.yml @@ -1,4 +1,4 @@ -# Jar files uploaded are used as a maven dependency by server +# Jar files uploaded are used as a maven dependency by server (eg: lobby) name: Create Http JAR files and upload to github packages on: push: @@ -18,7 +18,16 @@ jobs: # Fetch depth of 0 is needed so we checkout the full revision history # The current revision count will be used as our build-number fetch-depth: '0' - - name: Publish HTTP client JARs (used by servers) - run: ./gradlew publish + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + - name: set build version variables + run: | + BUILD_VERSION=$(game-app/run/.build/get-build-version) + echo "JAR_VERSION=$BUILD_VERSION" | tee -a $GITHUB_ENV + - name: Publish lobby client JAR + run: ./gradlew :http-clients:lobby-client:publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/game-app/game-headed/build.gradle b/game-app/game-headed/build.gradle index afca175ef9..64dccdc08a 100644 --- a/game-app/game-headed/build.gradle +++ b/game-app/game-headed/build.gradle @@ -7,7 +7,6 @@ plugins { archivesBaseName = "$group-$name" mainClassName = "org.triplea.game.client.HeadedGameRunner" -version = System.getenv("JAR_VERSION") ext { releasesDir = file("$buildDir/releases") @@ -44,24 +43,6 @@ jar { } } -publishing { - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/triplea-game/triplea") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } - publications { - shadow(MavenPublication) { publication -> - project.shadow.component(publication) - } - } -} - clean.doFirst { delete "$projectDir/.assets/" delete "$projectDir/assets/" diff --git a/http-clients/lobby-client/build.gradle b/http-clients/lobby-client/build.gradle index 6281c734b9..d69d6f53a0 100644 --- a/http-clients/lobby-client/build.gradle +++ b/http-clients/lobby-client/build.gradle @@ -3,6 +3,8 @@ plugins { id "com.github.johnrengelman.shadow" version "8.1.1" } +version = System.getenv("JAR_VERSION") + dependencies { implementation "io.github.openfeign:feign-core:$feignCoreVersion" implementation project(":game-app:domain-data") @@ -26,10 +28,6 @@ def getGitCommitCount = { -> return stdout.toString().trim() } -shadowJar { - version = "0." + getGitCommitCount() - archiveClassifier = "" -} publishing { repositories {