Skip to content

Commit

Permalink
Build config: publish http client lib jars (#12510)
Browse files Browse the repository at this point in the history
Updates github actions & gradle to publish JAR files of http
client libraries. The servers will in turn have a maven dependency
on these newly upload JAR files.
  • Loading branch information
DanVanAtta authored Apr 15, 2024
1 parent 2ccb520 commit 8868057
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/upload-http-client-jars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Jar files uploaded are used as a maven dependency by server
name: Create Http JAR files and upload to github packages
on:
push:
branches:
- master
paths:
- 'http-clients/**'
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 build version variables
run: |
COMMIT_NUMBER=$(git rev-list --count HEAD)
echo "commit_number=$COMMIT_NUMBER" | tee -a $GITHUB_ENV
- name: Publish HTTP client JARs (used by servers)
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_NUMBER: ${{ env.COMMIT_NUMBER }}
25 changes: 25 additions & 0 deletions http-clients/lobby-client/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id("maven-publish")
}

dependencies {
implementation "io.github.openfeign:feign-core:$feignCoreVersion"
implementation project(":game-app:domain-data")
Expand All @@ -10,3 +14,24 @@ dependencies {
testImplementation "org.apache.httpcomponents:httpclient:$apacheHttpComponentsVersion"
testImplementation project(":lib:test-common")
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/triplea-game/triplea"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
groupId = "org.triplea"
artifactId = "http.client.lobby"
version = "0." + System.getenv("COMMIT_NUMBER")
from(components.java)
}
}
}

0 comments on commit 8868057

Please sign in to comment.