Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#350 - Rework publishing plugins so they can be used externally and on multi-project builds #355

Merged
merged 6 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 44 additions & 35 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,80 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['17']
env:
WORKSPACE: ${{ github.workspace }}
java: ['17', '21']
steps:
- uses: actions/checkout@v4
- name: Set up JDK
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: ${{ matrix.java }}
jdaugherty marked this conversation as resolved.
Show resolved Hide resolved
- name: Run Build
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "🔨 Build project"
id: build
uses: gradle/gradle-build-action@v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: ./gradlew build
publish:
if: github.event_name == 'push'
needs: ['build']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: 17
- name: Publish Artifacts (repo.grails.org)
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📤 Publish Snapshot Artifacts to Artifactory (repo.grails.org/libs-snapshot-local)"
id: publish
uses: gradle/gradle-build-action@v3
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: |
-Dorg.gradle.internal.publish.checksums.insecure=true
publish
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: >
./gradlew
-Dorg.gradle.internal.publish.checksums.insecure=true
publish
docs:
if: github.event_name == 'push'
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: grails-build
GIT_USER_EMAIL: [email protected]
steps:
- name: Checkout repository
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: Set up JDK
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: 17
- name: Generate Groovydoc
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📜 Generate Groovydoc"
id: groovydoc
uses: gradle/gradle-build-action@v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: groovydoc
- name: Publish to Github Pages
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: ./gradlew groovydoc
- name: "🚀 Publish to Github Pages"
id: docs
if: success()
uses: grails/github-pages-deploy-action@v2
Expand All @@ -86,6 +96,5 @@ jobs:
BRANCH: gh-pages
FOLDER: build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Puneet Behl
VERSION: ${{ needs.publish.outputs.release_version }}
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
95 changes: 53 additions & 42 deletions .github/workflows/release.yml
jdaugherty marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,55 @@ jobs:
release_version: ${{ steps.release_version.outputs.value }}
target_branch: ${{ steps.extract_branch.outputs.value }}
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: 'grails-build'
GIT_USER_EMAIL: '[email protected]'
steps:
- name: Checkout repository
- name: "📥 Checkout repository"
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up JDK
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: 17
- name: Extract Target Branch
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📝 Store the target branch"
id: extract_branch
run: |
echo "Determining Target Branch"
TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'`
TARGET_BRANCH=${GITHUB_REF#refs/heads/}
echo $TARGET_BRANCH
echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
- name: Set the current release version
- name: "📝 Store the current release version"
id: release_version
run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- name: Run pre-release
- name: "⚙️ Run pre-release"
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Assemble
- name: "🧩 Run Assemble"
if: success()
id: assemble
uses: gradle/gradle-build-action@v3
with:
arguments: assemble
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: Upload Distribution
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: ./gradlew assemble
- name: "🚀 Upload Distribution"
if: success()
uses: actions/upload-artifact@v4
with:
name: grails-${{ steps.release_version.outputs.value }}.zip
path: build/distributions/grails-${{ steps.release_version.outputs.value }}.zip
- name: Generate secring file
- name: "📝 Generate secring file"
env:
SECRING_FILE: ${{ secrets.SECRING_FILE }}
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
- name: Publish to Sonatype OSSRH
- name: "🚀 Publish to Sonatype OSSRH"
id: publish
uses: gradle/gradle-build-action@v3
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand All @@ -67,9 +69,10 @@ jobs:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: |
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: >
./gradlew
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
publishToSonatype
closeSonatypeStagingRepository
Expand All @@ -79,26 +82,31 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK
- name: "📥 Checkout repository"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: 17
- name: Checkout repository
- name: "📥 Checkout repository"
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
ref: v${{ needs.publish.outputs.release_version }}
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: Nexus Staging Close And Release
uses: gradle/gradle-build-action@v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
with:
arguments: |
run: >
./gradlew
findSonatypeStagingRepository
releaseSonatypeStagingRepository
- name: Run post-release
Expand All @@ -114,38 +122,41 @@ jobs:
permissions:
contents: write
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: 'grails-build'
jdaugherty marked this conversation as resolved.
Show resolved Hide resolved
GIT_USER_EMAIL: '[email protected]'
steps:
- name: Checkout repository
- name: "📥 Checkout repository"
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
ref: v${{ needs.publish.outputs.release_version }}
- name: Set up JDK
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
distribution: liberica
java-version: 17
jdaugherty marked this conversation as resolved.
Show resolved Hide resolved
- name: Generate Groovydoc
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📜 Generate Groovydoc"
id: groovydoc
uses: gradle/gradle-build-action@v3
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: groovydoc
- name: Publish to Github Pages
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: ./gradlew groovydoc
- name: "🚀 Publish to Github Pages"
id: docs
if: success()
uses: grails/github-pages-deploy-action@v2
env:
SKIP_SNAPSHOT: ${{ contains(needs.publish.outputs.release_version, 'M') }}
SKIP_LATEST: ${{ !startsWith(needs.publish.outputs.target_branch, '6.1') }}
SKIP_LATEST: ${{ !startsWith(needs.publish.outputs.target_branch, '6.2') }}
TARGET_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
COMMIT_NAME: Puneet Behl
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
VERSION: ${{ needs.publish.outputs.release_version }}
56 changes: 52 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ grails-gsp
---------
* Configure GSP Compiling Task

grails-plugin-publish
---------
_Todo_: Add the docs

grails-plugin
---------
* Configure Ast Sources
Expand All @@ -41,6 +37,58 @@ grails-profile
---------
_Todo_: Add the docs

grails-profile-publish
---------
_Todo_: Add the docs

grails-publish
---------
A Gradle plugin to ease publishing with the maven publish plugin or the nexus publish plugin.

Example Usage:

grailsPublish {
websiteUrl = 'http://foo.com/myplugin'
license {
name = 'Apache-2.0'
}
issueTrackerUrl = 'https://github.com/myname/myplugin/issues'
vcsUrl = 'https://github.com/myname/myplugin'
title = 'My plugin title'
desc = 'My plugin description'
developers = [johndoe: 'John Doe']
}

or

grailsPublish {
githubSlug = 'foo/bar'
license {
name = 'Apache-2.0'
}
title = 'My plugin title'
desc = 'My plugin description'
developers = [johndoe: 'John Doe']
}

By default this plugin will publish to the specified `MAVEN_PUBLISH` instance for snapshots, and `NEXUS_PUBLISH` for releases. To change the snapshot publish behavior, set `snapshotRepoType` to `PublishType.NEXUS_PUBLISH`. To change the release publish behavior, set `releaseRepoType` to `PublishType.NEXUS_PUBLISH`.
jdaugherty marked this conversation as resolved.
Show resolved Hide resolved

The credentials and connection url must be specified as a project property or an environment variable.

`MAVEN_PUBLISH` Environment Variables are:

MAVEN_PUBLISH_USERNAME
MAVEN_PUBLISH_PASSWORD
MAVEN_PUBLISH_URL

`NEXUS_PUBLISH` Environment Variables are:

NEXUS_PUBLISH_URL
NEXUS_PUBLISH_SNAPSHOT_URL
NEXUS_PUBLISH_USERNAME
NEXUS_PUBLISH_PASSWORD
NEXUS_PUBLISH_STAGING_PROFILE_ID

jdaugherty marked this conversation as resolved.
Show resolved Hide resolved
grails-web
---------
* Adds web specific extensions
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ gradlePlugin {
}
grailsPluginPublish {
displayName = "Grails Publish Gradle Plugin"
description = 'A plugin to setup publishing to Grails central repo'
id = 'org.grails.internal.grails-plugin-publish'
implementationClass = 'org.grails.gradle.plugin.publishing.internal.GrailsCentralPublishGradlePlugin'
description = 'A plugin to assist in publishing Grails related artifacts'
id = 'org.grails.grails-plugin-publish'
implementationClass = 'org.grails.gradle.plugin.publishing.GrailsCentralPublishGradlePlugin'
}
grailsProfilePublish {
displayName = "Grails Profile Publish Plugin"
description = 'A plugin for publishing profiles'
id = 'org.grails.internal.grails-profile-publish'
implementationClass = 'org.grails.gradle.plugin.profiles.internal.GrailsProfilePublishGradlePlugin'
id = 'org.grails.grails-profile-publish'
implementationClass = 'org.grails.gradle.plugin.profiles.GrailsProfilePublishGradlePlugin'
}
}
}
Expand Down
Loading
Loading