{"id":15970932,"url":"https://github.com/rainbowdashlabs/publishdata","last_synced_at":"2025-08-13T14:34:10.695Z","repository":{"id":136235750,"uuid":"425490784","full_name":"rainbowdashlabs/publishdata","owner":"rainbowdashlabs","description":"Gradle plugin used to avoid boilerplate code for release detection on my projects","archived":false,"fork":false,"pushed_at":"2024-11-27T16:12:51.000Z","size":186,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-27T17:24:13.923Z","etag":null,"topics":["developer-tools","devops","gradle-plugin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rainbowdashlabs.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-07T11:57:37.000Z","updated_at":"2024-01-16T08:57:29.000Z","dependencies_parsed_at":"2024-01-18T16:59:24.086Z","dependency_job_id":"501bf938-269e-4e49-b193-11f2251fab71","html_url":"https://github.com/rainbowdashlabs/publishdata","commit_stats":{"total_commits":32,"total_committers":4,"mean_commits":8.0,"dds":0.34375,"last_synced_commit":"742ad82fdb94947906071a1045fc924645fae79f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainbowdashlabs%2Fpublishdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainbowdashlabs%2Fpublishdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainbowdashlabs%2Fpublishdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainbowdashlabs%2Fpublishdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rainbowdashlabs","download_url":"https://codeload.github.com/rainbowdashlabs/publishdata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229767243,"owners_count":18121045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","devops","gradle-plugin"],"created_at":"2024-10-07T20:05:13.479Z","updated_at":"2024-12-15T00:16:44.496Z","avatar_url":"https://github.com/rainbowdashlabs.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/RainbowDashLabs/publishdata/verify.yml?style=for-the-badge\u0026label=Building)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/RainbowDashLabs/publishdata/publish_to_nexus.yml?style=for-the-badge\u0026label=Publishing) \\\n![Sonatype Nexus (Releases)](https://img.shields.io/nexus/maven-releases/de.chojo/publishdata?label=Release\u0026logo=Release\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)\n![Sonatype Nexus (Development)](https://img.shields.io/nexus/maven-dev/de.chojo/publishdata?label=DEV\u0026logo=Release\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)\n![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/de.chojo/publishdata?color=orange\u0026label=Snapshot\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)\n\nSmall gradle plugin which I use to avoid boilerplate code for version detection.\n\nThis util helps to publish artifacts, sets the correction version with optional commit hash and branch identifier and\nchooses the repository based on the current branch.\n\n## Setup\n\n### settings.gradle.kts\n\nAdd the eldonexus as a plugin repository\n\n```kotlin\npluginManagement {\n    repositories {\n        maven(\"https://eldonexus.de/repository/maven-public/\")\n    }\n}\n```\n\n### build.gradle.kts\n\n#### General\n\nApply the publishdata as a plugin\n```\nplugins {\n    id(\"de.chojo.publishdata\") version \"version\"\n}\n```\n\nBasic configuration which tasks you want to publish\n```kt\npublishData {\n    // Add tasks which should be published\n    publishTask(\"jar\")\n    publishTask(\"sourcesJar\")\n    publishTask(\"javadocJar\")\n}\n```\n\nAdditional publishData can generate a `build.data` file which contains information about the build itself.\n\n```\ntime=ISO 8601 formatted timestamp\nunix=unix timestamp of build time\ntype=build type\nbranch=branch\ncommit=commit hash\nartifactVersion=version\nartifact=artifact name\nruntime=java runtime used to build\n```\n\nTo enable that simply add this to your configuration\n\n```kt\npublishData {\n    addBuildData()\n}\n```\n\nThis function also accepts a map to add additional values.\n\n#### Adding repositories\nYou have to define repositories like that or chose the eldonexus or gitlab configuration below:\n\n```kt\npublishData {\n    // manually register a release repo for main branch\n    addMainRepo(\"https://my-repo.com/releases\")\n    // manually register a snapshot repo which will append -SNAPSHOT+\u003ccommit_hash\u003e\n    addSnapshotRepo(\"https://my-repo.com/snapshots\")\n}\n\npublishing {\n    publications.create\u003cMavenPublication\u003e(\"maven\") {\n        // configure the publication as defined previously.\n        publishData.configurePublication(this)\n    }\n\n    repositories {\n        maven {\n            authentication {\n                // Auth for the repository\n                // ....\n            }\n\n            name = \"MyRepo\"\n            // Get the detected repository from the publishData\n            url = uri(publishData.getRepository())\n        }\n    }\n}\n```\n\nMake sure to declare them in the correct order. PublishData will take the first applicable repository. \n\n#### Eldonexus\n\nAdditionaly call this in the configuration to publish to the eldonexus.\nThis will preconfigure for main, master, dev and snapshot branches.\n\n```kt\npublishData {\n    // only if you want to publish to the eldonexus. If you call this you will not need to manually add repositories\n    useEldoNexusRepos()\n}\n```\n\n#### GitLab\nAdditionaly call this in the configuration to publish to a gitlab repository and replace your repository declaration.\n\n```kt\npublishData {\n    // only if you want to publish to the gitlab. If you call this you will not need to manually add repositories\n    useGitlabReposForProject(\"177\", \"https://gitlab.example.com/\")\n}\n\npublishing {\n    publications.create\u003cMavenPublication\u003e(\"maven\") {\n        // configure the publication as defined previously.\n        publishData.configurePublication(this)\n    }\n\n    repositories {\n        maven {\n            credentials(HttpHeaderCredentials::class) {\n                name = \"Job-Token\"\n                value = System.getenv(\"CI_JOB_TOKEN\")\n            }\n            authentication {\n                create(\"header\", HttpHeaderAuthentication::class)\n            }\n            \n            name = \"Gitlab\"\n            // Get the detected repository from the publish data\n            url = uri(publishData.getRepository())\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainbowdashlabs%2Fpublishdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frainbowdashlabs%2Fpublishdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainbowdashlabs%2Fpublishdata/lists"}