enonic / xp-distro

Enonic XP full distribution.
GNU General Public License v3.0
3 stars 3 forks source link

Research GitHub Packages as a new repo #95

Closed jsi closed 4 years ago

jsi commented 4 years ago
edloidas commented 4 years ago

GitHub Packages

About GitHub Packages

Pricing & Billing

Package Clients

Package client Language Package format Description
npm JavaScript package.json Node package manager
gem Ruby Gemfile RubyGems package manager
mvn Java pom.xml Apache Maven project management and comprehension tool
gradle Java build.gradle or build.gradle.kts Gradle build automation tool for Java
docker N/A Dockerfile Docker container management platform
dotnet CLI .NET nupkg NuGet package management for .NET

Publishing Package

See @Codertocat/hello-world-npm for an package example.

Siteimprove Application

The Siteimprove package has been published to packages.

The list of packages for the repo is accessible through the package button on the code panel next to the branches.

The app-siteimprove list of packages can be found here.

Publishing Siteimprove Application

plugins {
    id 'maven-publish'
    // Disable Gradle default plugin, since it's currently doing the same, but published to different URL
    //  id 'com.enonic.defaults' version '2.0.1'
}

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/enonic/app-siteimprove")
            credentials {
                username = project.findProperty("user") ?: System.getenv("GITHUB_USERNAME")
                password = project.findProperty("token") ?: System.getenv("GITHUB_TOKEN")
            }
        }

    }
    publications {
        gpr(MavenPublication) {
            from(components.java)
        }
    }
}

To publish packages simply run publish task, passing your data as parameters.

gradle publish -x lint -Puser=username -Ptoken=81ee323a14e1f667ab2db7935ecf66331cd9bc3b

GitHub Token

To publish or install packages from GitHub you need to generate a personal token with proper rights.

Installing Package

Just add published package as a dependency and a related repository:

repositories {
    maven {
        name "github"
        // To target the single (namespace) repo, use:
        // https://maven.pkg.github.com/enonic/app-siteimprove
        // Using `*` will target all repos of the organization
        url "https://maven.pkg.github.com/enonic/*"
        credentials {
            username "username"
            password "81ee323a14e1f667ab2db7935ecf66331cd9bc3b"
        }
    }
}

dependencies {
    compile "com.enonic.app:siteimprove:1.4.2"
}

FAQ

Q: Is it possible to move our entire old repo into Packages? A: Only manually and it's a big piece of work.

Q: Who is using Artifactory API and how? (CLI, market, Gradle plugin, old Enonic download) A: CLI to fetch bundle versions, gradle-defaults plugin for publishing bundles; maybe more?

Q: How does pricing work? A: See the "Pricing & Billing" section.

Q: What can we put there? Only our own things? A: Everything. But we should find if it's reasonable to put 'em there and the license allows that.

Q: Mix and match private and public? A: Yes, you can. To upload and download packages from GitHub you need to configure your tools, be authenticated and have rights to do interact with the repository, that package belongs to. As for the billing, you will only pay for the private repos.


Q: Where can I find the list of packages? A: Under the organization's Packages tab.

Q: Does the GitHub has the API to work with packages? A: Yes, it does have the API. Here is a user example of listing all the packages from the registry.

edloidas commented 4 years ago

GitHub Packages ±

Pros

Cons

edloidas commented 4 years ago
jsi commented 4 years ago

Great work here. Seems the Cons are too many, so for now, we are just staying with our current solution of operating Artifactory ourselves. Turned out to be some simpler ways of doing it.