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

Add github action to publish TripleA client Jar file #12618

Merged
merged 1 commit into from
Jun 6, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/publish-jar-file.yml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 19 additions & 0 deletions game-app/game-headed/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {

archivesBaseName = "$group-$name"
mainClassName = "org.triplea.game.client.HeadedGameRunner"
version = System.getenv("JAR_VERSION")

ext {
releasesDir = file("$buildDir/releases")
Expand Down Expand Up @@ -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/"
Expand Down
Loading