Skip to content

Commit

Permalink
Add publishing support
Browse files Browse the repository at this point in the history
  • Loading branch information
danielperano committed Feb 17, 2025
1 parent a16efc9 commit 0394400
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish

on: push

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0' # Get all tags - necessary for Gradle versioning
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
server-id: github
settings-path: ${{ github.workspace }}

- name: Build with Gradle
run: ./gradlew build

- name: Publish to GitHub Packages
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 13 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ configurations {
profiling
}

def getGitVersion(){
"git describe --tags --always --first-parent".execute().text.trim()
}

group = 'myworld'
version = '0.0.1-SNAPSHOT'
version = getGitVersion()

dependencies {

Expand Down Expand Up @@ -121,5 +125,13 @@ publishing {

repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/MyWorldLLC/Chipmunk")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
}

0 comments on commit 0394400

Please sign in to comment.