Skip to content

Commit

Permalink
Publish to Maven Central with static versions
Browse files Browse the repository at this point in the history
Fixes #97
  • Loading branch information
ajoberstar committed Feb 9, 2022
1 parent bcb802c commit 8f5d060
Show file tree
Hide file tree
Showing 27 changed files with 373 additions and 457 deletions.
Empty file removed .github/CONTRIBUTING.md
Empty file.
38 changes: 0 additions & 38 deletions .github/workflows/build.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Dorg.gradle.java.installations.fromEnv=JAVA_HOME_8_x64,JAVA_HOME_11_x64,JAVA_HOME_17_x64
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java 11
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Gradle check
run: ./gradlew check --continue
80 changes: 23 additions & 57 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,33 @@
name: Release
on:
push:
tags:
- "*"
tags: ["*"]
jobs:
check:
release:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 15]
fail-fast: false
steps:
- name: "Checkout repo"
uses: "actions/checkout@v2"
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "Setup Java ${{ matrix.java }}"
uses: "actions/setup-java@v1"
with:
java-version: ${{ matrix.java }}
- name: "Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1
- name: "Cache Gradle wrapper"
uses: "actions/cache@v2"
with:
path: |
~/.gradle/wrapper
~/.gradle/notifications
key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle dependencies"
uses: "actions/cache@v2"
with:
path: "~/.gradle/caches"
key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}"
- name: "Gradle check"
run: "./gradlew check --continue"
publish:
runs-on: ubuntu-latest
needs: check
steps:
- name: "Checkout repo"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Setup Java"
uses: "actions/setup-java@v1"
with:
java-version: 8
- name: "Cache Gradle wrapper"
uses: "actions/cache@v2"
with:
path: |
~/.gradle/wrapper
~/.gradle/notifications
key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle dependencies"
uses: "actions/cache@v2"
with:
path: "~/.gradle/caches"
key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}"
- name: "Gradle publish"
- name: Setup Java 11
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Gradle publish
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.PGP_SIGNING_PASSPHRASE }}
GRADLE_OPTS: "-Dorg.gradle.project.gradle.publish.key=${{ secrets.GRADLE_PLUGIN_KEY }} -Dorg.gradle.project.gradle.publish.secret=${{ secrets.GRADLE_PLUGIN_SECRET }}"
run: "./gradlew publish publishPlugins"
run: ./gradlew publishAllPublicationsToCentralReleasesRepository
4 changes: 0 additions & 4 deletions .stutter/java15.lock

This file was deleted.

6 changes: 0 additions & 6 deletions .stutter/java8.lock

This file was deleted.

25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# gradle-git-publish

![](https://github.com/ajoberstar/gradle-git-publish/workflows/.github/workflows/build.yaml/badge.svg)
[![CI](https://github.com/ajoberstar/gradle-git-publish/actions/workflows/ci.yaml/badge.svg)](https://github.com/ajoberstar/gradle-git-publish/actions/workflows/ci.yaml)

## Project News

### Newest versions are on Maven Central

As of 3.0.1, gradle-git-publish is published to Maven Central.

This project is no longer directly published to the Gradle Plugin Portal, but since the portal proxies Maven Central you can still access it through the portal. The only side effect is that [the portal](https://plugins.gradle.org/plugin/org.ajoberstar.git-publish) will no longer list the latest version. Use this repo or [search.maven.org](https://search.maven.org/search?q=g:org.ajoberstar.git-publish) to find the latest version.

### Retirement of Bintray/JCenter

This project was previously uploaded to JCenter, which is being retired by JFrog on May 1st 2021.
Expand Down Expand Up @@ -42,29 +48,12 @@ changes and compatibility with Java and Gradle versions.

### Applying the Plugin

**Plugins DSL**

```groovy
plugins {
id 'org.ajoberstar.git-publish' version '<version>'
}
```

**Classic**

```groovy
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.ajoberstar:gradle-git-publish:<version>'
}
}
apply plugin: 'org.ajoberstar.git-publish'
```

### Configuration

**NOTE:** In general, there are no default values here. The main exception is that the `repoUri` and `referenceRepoUri` will be automatically set if you use the `org.ajoberstar.grgit` plugin to your project's origin repo URI.
Expand Down
81 changes: 0 additions & 81 deletions build.gradle

This file was deleted.

91 changes: 91 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
plugins {
id("org.ajoberstar.defaults.gradle-plugin")
groovy

id("org.ajoberstar.stutter")
id("org.ajoberstar.grgit")
id("org.ajoberstar.reckon")
}

group = "org.ajoberstar.git-publish"
description = "Gradle plugin for publishing to Git repositories"

reckon {
scopeFromProp()
stageFromProp("beta", "rc", "final")
}

mavenCentral {
developerName.set("Andrew Oberstar")
developerEmail.set("ajoberstar@gmail.com")
githubOwner.set("ajoberstar")
githubRepository.set("reckon")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

dependencies {
// grgit
api("org.ajoberstar.grgit:grgit-core:[4.0,5.0[")
compatTestImplementation("org.ajoberstar.grgit:grgit-core:[4.0,5.0[")

// testing
compatTestImplementation(gradleTestKit())
compatTestImplementation("org.spockframework:spock-core:2.0-groovy-3.0")
}

tasks.named<Jar>("jar") {
manifest {
attributes.put("Automatic-Module-Name", "org.ajoberstar.git.publish.gradle")
}
}

tasks.withType<Test> {
useJUnitPlatform()
}

stutter {
val java8 by matrices.creating {
javaToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
gradleVersions {
compatibleRange("5.0")
}
}
val java11 by matrices.creating {
javaToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
gradleVersions {
compatibleRange("5.0")
}
}
val java17 by matrices.creating {
javaToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
gradleVersions {
compatibleRange("7.3")
}
}
}

tasks.named("check") {
dependsOn(tasks.named("compatTest"))
}

gradlePlugin {
plugins {
create("plugin") {
id = "org.ajoberstar.git-publish"
displayName = "Git Publish Plugin"
description = "Gradle plugin for publishing to Git repositories"
implementationClass = "org.ajoberstar.gradle.git.publish.GitPublishPlugin"
}
}
}
Loading

0 comments on commit 8f5d060

Please sign in to comment.