-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action to publish packages to mzio (#2285)
* add publish actions to upload packages in mzio repo * update publish actions * update publish actions * publish locally for testing use ./gradlew convention-plugins:java-convention:publish for convention plugins * update action to publish convention plugins * update publish task names * make publish tasks publish on github * add centralised publishing config * update package names * review
- Loading branch information
1 parent
d812816
commit bfdee8b
Showing
10 changed files
with
328 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,3 @@ jobs: | |
prerelease: true | ||
title: "Release build" | ||
files: build/*/* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Publish packages to GitHub Packages | ||
on: | ||
workflow_dispatch | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: '22.0.1' | ||
distribution: 'temurin' | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | ||
|
||
- name: Publish mzmine packages | ||
run: ./gradlew publish | ||
env: | ||
PUBLISH_PACKAGE_USERNAME: ${{ secrets.PUBLISH_PACKAGE_USERNAME }} | ||
PUBLISH_PACKAGE_TOKEN: ${{ secrets.PUBLISH_PACKAGE_TOKEN }} | ||
- name: Publish convention plugins | ||
run: ./gradlew convention-plugins:java-convention:publish | ||
env: | ||
PUBLISH_PACKAGE_USERNAME: ${{ secrets.PUBLISH_PACKAGE_USERNAME }} | ||
PUBLISH_PACKAGE_TOKEN: ${{ secrets.PUBLISH_PACKAGE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
plugins { | ||
`maven-publish` | ||
} | ||
|
||
// list of sub projects that create a java library | ||
val publishingSubProjects = listOf( | ||
"convention-plugins", | ||
"java-convention", | ||
"javafx-framework", | ||
"mzmine-community", | ||
"taskcontroller", | ||
"utils" | ||
) | ||
|
||
|
||
subprojects { | ||
// this variable is set by running .\gradlew publish with the command line argument -Pmziorepo=true | ||
val pushOnline: Boolean = project.findProperty("mziorepo")?.toString()?.toBoolean() ?: false | ||
if(name in publishingSubProjects) { | ||
apply(plugin = "maven-publish") | ||
|
||
publishing { | ||
repositories { | ||
if (pushOnline) { | ||
maven { | ||
url = uri("https://maven.pkg.github.com/mzio-gmbh/mzio_mzmine") | ||
credentials { | ||
username = System.getenv("PUBLISH_PACKAGE_USERNAME") | ||
password = System.getenv("PUBLISH_PACKAGE_TOKEN") | ||
} | ||
} | ||
} else { | ||
maven { | ||
url = uri(layout.projectDirectory.dir("../local-repo/")) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,62 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
id("maven-publish") | ||
alias(libs.plugins.semver) | ||
} | ||
|
||
semver { | ||
properties = "../../mzmine-community/src/main/resources/mzmineversion.properties" | ||
} | ||
|
||
// this variable is set by running .\gradlew publish with the command line argument -Pmziorepo=true | ||
val pushOnline: Boolean = project.findProperty("mziorepo")?.toString()?.toBoolean() ?: false | ||
|
||
|
||
kotlin { | ||
jvmToolchain(21) | ||
} | ||
|
||
dependencies { | ||
implementation(libs.javafx.plugin) | ||
} | ||
|
||
afterEvaluate { | ||
// the repositories must be set in the afterEvaluate block, because the semver plugin will | ||
// not be initialised otherwise. The convention plugin version is bound to the mzmine community version. | ||
publishing { | ||
repositories { | ||
if (pushOnline) { | ||
maven { | ||
url = uri("https://maven.pkg.github.com/mzio-gmbh/mzio_mzmine") | ||
credentials { | ||
username = System.getenv("PUBLISH_PACKAGE_USERNAME") | ||
password = System.getenv("PUBLISH_PACKAGE_TOKEN") | ||
} | ||
} | ||
} else { | ||
maven { | ||
url = uri(layout.projectDirectory.dir("../../local-repo/")) | ||
} | ||
} | ||
} | ||
publications { | ||
register<MavenPublication>("publish-convention-plugins") { | ||
from(components["java"]) | ||
pom { | ||
group = "io.github.mzmine" | ||
artifactId = "convention-plugins" | ||
name = "mzmine-community convention-plugins" | ||
description = "mzmine-community convention plugins" | ||
url = "https://github.com/mzmine/mzmine" | ||
version = semver.version | ||
developers { | ||
developer { | ||
id = "mzmine" | ||
name = "mzmine" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.