Skip to content

Commit

Permalink
First crack at publishing a Maven package (probably broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Mar 22, 2024
1 parent 844cbe4 commit d0da5bc
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Gradle Package

on:
# TODO: Remove push trigger
push:
branches:
- main
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Gradle build
run: ./gradlew build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: ./gradlew publish
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 14 additions & 1 deletion android/MapLibreUI/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,17 @@ dependencies {
androidTestImplementation platform('androidx.compose:compose-bom:2024.02.00')
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
}
}

afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from components.release

groupId = 'com.stadiamaps'
artifactId = 'ferrostar-maplibreui'
}
}
}
}
20 changes: 19 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,22 @@ plugins {
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
id 'com.github.willir.rust.cargo-ndk-android' version '0.3.4' apply false
id 'com.ncorti.ktfmt.gradle' version '0.17.0' apply false
}
id 'maven-publish'
}

subprojects {
version = "0.0.1"

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/stadiamaps/ferrostar")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}

0 comments on commit d0da5bc

Please sign in to comment.