From 82403da5e8ebb600c55fddcb418ba8e5734e1944 Mon Sep 17 00:00:00 2001 From: DanVanAtta Date: Wed, 5 Jun 2024 19:26:41 -0700 Subject: [PATCH] Add github action to publish TripleA client Jar file The jar file will in turn be used as a dependency for other repositories, specifically things like the lobby. Revert "Release update: set all new builds as 'releases' (used to be prerelease) (#12568)" (#12617) This reverts commit 73249a04df3ccd50f6a7d151e16b29468d252f6a. Update lobby message (#12616) Bump com.google.guava:guava from 33.2.0-jre to 33.2.1-jre (#12610) --- .github/workflows/publish-jar-file.yml | 33 ++++++++++++++++++++++++++ game-app/game-headed/build.gradle | 19 +++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/publish-jar-file.yml diff --git a/.github/workflows/publish-jar-file.yml b/.github/workflows/publish-jar-file.yml new file mode 100644 index 0000000000..3853729b8f --- /dev/null +++ b/.github/workflows/publish-jar-file.yml @@ -0,0 +1,33 @@ +# 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/game-app/game-headed/build.gradle b/game-app/game-headed/build.gradle index 64dccdc08a..afca175ef9 100644 --- a/game-app/game-headed/build.gradle +++ b/game-app/game-headed/build.gradle @@ -7,6 +7,7 @@ plugins { archivesBaseName = "$group-$name" mainClassName = "org.triplea.game.client.HeadedGameRunner" +version = System.getenv("JAR_VERSION") ext { releasesDir = file("$buildDir/releases") @@ -43,6 +44,24 @@ 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/"