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

Prepare central deployment #221

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
40 changes: 28 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,51 @@ on:
- master
pull_request:
jobs:
tests:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
java: [ '8', '11' ]
env:
WORKSPACE: ${{ github.workspace }}
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
steps:
- name: Print Dispatch Information
if: github.event_name == 'workflow_dispatch'
env:
DISPATCH_INFORMATION: ${{ github.event.inputs.message }}
run: echo $DISPATCH_INFORMATION
- uses: actions/checkout@v2
- run: cd $GITHUB_WORKSPACE

- uses: actions/setup-java@v1
- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
java-package: jdk
architecture: x64

- run: ./gradlew check
- uses: actions/upload-artifact@v2
- name: Run all tests
run: ./gradlew check
- name: Upload audit-test artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: testreport-audit-test-${{ matrix.java }}
path: examples/audit-test/build/reports/tests
- uses: actions/upload-artifact@v2
- name: Upload audit-test allow-update-outside-transaction artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: testreport-audit-test-allow-update-outside-transaction-${{ matrix.java }}
path: examples/audit-test-allow-update-outside-transaction/build/reports/tests

- run: ./gradlew :examples:audit-test:check -Daudit-test.AuditTrail.datasource=DEFAULT
- uses: actions/upload-artifact@v2
- name: Run tests with single datasource
run: ./gradlew :examples:audit-test:check -Daudit-test.AuditTrail.datasource=DEFAULT
- name: Upload audit-test single-datasource artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: testreport-audit-test-single-datasource-${{ matrix.java }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8']
env:
GIT_USER_NAME: robertoschwald
GIT_USER_EMAIL: [email protected]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Set the current release version
id: release_version
run: echo ::set-output name=release_version::${GITHUB_REF:11}
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- 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
id: publish
uses: gradle/gradle-build-action@v2
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
with:
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Publish Documentation
id: docs
if: steps.publish.outcome == 'success'
uses: gradle/gradle-build-action@v2
with:
arguments: docs
- name: Export Gradle Properties
uses: micronaut-projects/github-actions/export-gradle-properties@master
- name: Publish to Github Pages
if: steps.docs.outcome == 'success'
uses: micronaut-projects/github-pages-deploy-action@master
env:
BETA: ${{ contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC') }}
TARGET_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: plugin/build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Robert Oschwald
VERSION: ${{ steps.release_version.outputs.release_version }}
- name: Run post-release
if: success()
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
env:
SNAPSHOT_SUFFIX: -SNAPSHOT
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M

vcsUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
websiteUrl=https://github.com/robertoschwald/grails-audit-logging-plugin
issueTrackerUrl=https://github.com/robertoschwald/grails-audit-logging-plugin/issues
vcsUrl=https://github.com/symentis/grails-audit-logging-plugin
websiteUrl=https://github.com/symentis/grails-audit-logging-plugin
issueTrackerUrl=https://github.com/symentis/grails-audit-logging-plugin/issues
13 changes: 0 additions & 13 deletions gradle/artifactoryPublish.gradle

This file was deleted.

22 changes: 0 additions & 22 deletions gradle/grailsPublish.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion makedoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST
echo " "
echo "** Updating gh-pages branch **"
pushd plugin/build
git clone https://github.com/robertoschwald/grails-audit-logging-plugin.git -b gh-pages gh-pages --single-branch > /dev/null
git clone https://github.com/symentis/grails-audit-logging-plugin.git -b gh-pages gh-pages --single-branch > /dev/null
cd gh-pages

# prepare index.html
Expand Down
6 changes: 2 additions & 4 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import java.text.SimpleDateFormat

buildscript {
repositories {
mavenLocal()
// mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
Expand All @@ -19,7 +19,7 @@ plugins {
}

version project.file("../version.txt").text.trim()
group "org.grails.plugins"
group "com.symentis.grails.plugins"

apply plugin: "eclipse"
apply plugin: "idea"
Expand Down Expand Up @@ -78,8 +78,6 @@ task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

apply from: "${rootProject.projectDir}/gradle/grailsPublish.gradle"
apply from: "${rootProject.projectDir}/gradle/artifactoryPublish.gradle"
apply from: "${rootProject.projectDir}/gradle/docs.gradle"


Expand Down
12 changes: 6 additions & 6 deletions plugin/src/docs/templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</head>

<body>
<a href="http://github.com/robertoschwald/grails-audit-logging-plugin">
<a href="http://github.com/symentis/grails-audit-logging-plugin">
<img style="position: absolute; top: 0; right: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" />
</a>

Expand Down Expand Up @@ -111,22 +111,22 @@
<hr />

<div class="download">
<a href="http://github.com/robertoschwald/grails-audit-logging-plugin/zipball/master">
<a href="http://github.com/symentis/grails-audit-logging-plugin/zipball/master">
<img width="90" src="http://github.com/images/modules/download/zip.png">
</a>
<a href="http://github.com/robertoschwald/grails-audit-logging-plugin/tarball/master">
<a href="http://github.com/symentis/grails-audit-logging-plugin/tarball/master">
<img width="90" src="http://github.com/images/modules/download/tar.png">
</a>
</div>

<h2>Download Source</h2>
<p>
You can download this project in either
<a href="http://github.com/robertoschwald/grails-audit-logging-plugin/zipball/master">zip</a> or
<a href="http://github.com/robertoschwald/grails-audit-logging-plugin/tarball/master">tar</a> formats.
<a href="http://github.com/symentis/grails-audit-logging-plugin/zipball/master">zip</a> or
<a href="http://github.com/symentis/grails-audit-logging-plugin/tarball/master">tar</a> formats.
</p>
<p>You can also clone the project with <a href="http://git-scm.com">Git</a> by running:
<pre>$ git clone git://github.com/robertoschwald/grails-audit-logging-plugin</pre>
<pre>$ git clone git://github.com/symentis/grails-audit-logging-plugin</pre>
</p>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException
* http://www.hibernate.org/318.html
*
* See Documentation:
* https://github.com/robertoschwald/grails-audit-logging-plugin
* https://github.com/symentis/grails-audit-logging-plugin
*
*/
@Slf4j
Expand All @@ -49,7 +49,7 @@ class AuditLoggingGrailsPlugin extends Plugin {
def description = """
Automatically log change events for domain objects. Optionally supports Stamping. This plugin is ORM agnostic.
"""
String documentation = 'https://github.com/robertoschwald/grails-audit-logging-plugin'
String documentation = 'https://github.com/symentis/grails-audit-logging-plugin'
String license = 'APACHE'

def developers = [
Expand All @@ -58,8 +58,8 @@ class AuditLoggingGrailsPlugin extends Plugin {
[name: 'Aaron Long', email: '[email protected]']
]

def issueManagement = [system: 'GitHub', url: 'https://github.com/robertoschwald/grails-audit-logging-plugin/issues']
def scm = [url: 'https://github.com/robertoschwald/grails-audit-logging-plugin']
def issueManagement = [system: 'GitHub', url: 'https://github.com/symentis/grails-audit-logging-plugin/issues']
def scm = [url: 'https://github.com/symentis/grails-audit-logging-plugin']
def loadAfter = ['core', 'dataSource', 'springSecurityCore']

// Register generic GORM listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import grails.plugins.orm.auditable.resolvers.AuditRequestResolver
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.grails.datastore.mapping.core.Datastore
import org.grails.datastore.mapping.engine.EntityAccess
import org.grails.datastore.mapping.engine.event.AbstractPersistenceEvent
import org.grails.datastore.mapping.engine.event.AbstractPersistenceEventListener
import org.grails.datastore.mapping.engine.event.EventType
Expand Down Expand Up @@ -60,7 +61,6 @@ class StampListener extends AbstractPersistenceEventListener {
}

try {
Stampable domain = event.entityObject as Stampable
log.trace("Stamping object {}", event.entityObject.class.name)

// Lookup the request resolver here to ensure that applications have a chance
Expand All @@ -69,10 +69,10 @@ class StampListener extends AbstractPersistenceEventListener {

switch(event.eventType) {
case EventType.PreInsert:
handleInsert(domain, requestResolver)
handleInsert(event.entityAccess, requestResolver)
break
case EventType.PreUpdate:
handleUpdate(domain, requestResolver)
handleUpdate(event.entityAccess, requestResolver)
break
}
}
Expand All @@ -94,17 +94,17 @@ class StampListener extends AbstractPersistenceEventListener {
/**
* Stamp inserts
*/
protected void handleInsert(Stampable domain, AuditRequestResolver requestResolver) {
protected void handleInsert(EntityAccess domain, AuditRequestResolver requestResolver) {
// Set actors, Grails will take care of setting the dates
String currentActor = requestResolver.currentActor
domain.createdBy = currentActor
domain.lastUpdatedBy = currentActor
domain.setProperty("createdBy", currentActor)
domain.setProperty("lastUpdatedBy", currentActor)
}

/**
* Stamp updates
*/
protected void handleUpdate(Stampable domain, AuditRequestResolver requestResolver) {
domain.lastUpdatedBy = requestResolver.currentActor
protected void handleUpdate(EntityAccess domain, AuditRequestResolver requestResolver) {
domain.setProperty("lastUpdatedBy", requestResolver.currentActor)
}
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
5.0.0-SNAPSHOT
5.0.0