Skip to content

Commit 689ee7c

Browse files
authored
Merge pull request #2 from gpc/5.x.x
Upgrading plugin and master branch to Grails 5
2 parents f4b05db + 9bde0c3 commit 689ee7c

25 files changed

+646
-276
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 8
20+
uses: actions/setup-java@v2
21+
with:
22+
java-version: '8'
23+
distribution: 'adopt'
24+
cache: gradle
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
- name: Build with Gradle
28+
run: ./gradlew build

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [ published ]
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
env:
9+
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
10+
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
with:
15+
token: ${{ secrets.GH_TOKEN }}
16+
- uses: gradle/wrapper-validation-action@v1
17+
- name: Set up JDK
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 8
21+
- name: Get latest release version number
22+
id: get_version
23+
uses: battila7/get-version-action@v2
24+
- name: Run pre-release
25+
uses: micronaut-projects/github-actions/pre-release@master
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Publish to Sonatype OSSRH
29+
env:
30+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
31+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
32+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
33+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
34+
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
35+
SECRING_FILE: ${{ secrets.SECRING_FILE }}
36+
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
37+
run: |
38+
echo "${SECRING_FILE}" | base64 -d > "${GITHUB_WORKSPACE}/secring.gpg"
39+
echo "Publishing Artifacts for $RELEASE_VERSION"
40+
(set -x; ./gradlew -Pversion="${RELEASE_VERSION}" -Psigning.secretKeyRingFile="${GITHUB_WORKSPACE}/secring.gpg" publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon)
41+
- name: Bump patch version by one
42+
uses: actions-ecosystem/action-bump-semver@v1
43+
id: bump_semver
44+
with:
45+
current_version: ${{steps.get_version.outputs.version-without-v }}
46+
level: patch
47+
- name: Set version in gradle.properties
48+
env:
49+
NEXT_VERSION: ${{ steps.bump_semver.outputs.new_version }}
50+
run: |
51+
echo "Preparing next snapshot"
52+
./gradlew snapshotVersion -Pversion="${NEXT_VERSION}"
53+
- name: Commit & Push changes
54+
uses: actions-js/push@master
55+
with:
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
author_name: ${{ secrets.GIT_USER_NAME }}
58+
author_email: $${ secrets.GIT_USER_EMAIL }}
59+
message: 'Set version to next SNAPSHOT'
60+
- name: Build documentation
61+
env:
62+
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
63+
run: |
64+
./gradlew asciidoctor -Pversion="${RELEASE_VERSION}"
65+
- name: Export Gradle Properties
66+
uses: micronaut-projects/github-actions/export-gradle-properties@master
67+
- name: Publish to Github Pages
68+
if: success()
69+
uses: micronaut-projects/github-pages-deploy-action@master
70+
env:
71+
BETA: ${{ steps.get_version.outputs.isPrerelase }}
72+
TARGET_REPOSITORY: ${{ github.repository }}
73+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
74+
BRANCH: gh-pages
75+
FOLDER: build/asciidoc
76+
DOC_FOLDER: latest
77+
COMMIT_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
78+
COMMIT_NAME: ${{ secrets.GIT_USER_NAME }}
79+
VERSION: ${{ steps.get_version.outputs.version-without-v }}
80+
- name: Run post-release
81+
if: success()
82+
uses: micronaut-projects/github-actions/post-release@master
83+
with:
84+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: '00 06 * * 1'
6+
7+
jobs:
8+
stale:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
steps:
16+
- uses: actions/stale@v3
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
stale-issue-message: 'This issue looks like it is stale and therefor it is in risk of being closed with no further action.'
20+
stale-pr-message: 'This pull request looks like it is stale and therefor it is in risk of being closed with no further action.'
21+
stale-issue-label: 'no-issue-activity'
22+
stale-pr-label: 'no-pr-activity'
23+
days-before-stale: 180

README.md

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The Grails Asynchronous Mail plugin
22
====================================
33

4-
[![Build Status](https://travis-ci.org/kefirfromperm/grails-asynchronous-mail.svg?branch=master)](https://travis-ci.org/kefirfromperm/grails-asynchronous-mail) [![Download](https://api.bintray.com/packages/kefirsf/plugins/asynchronous-mail/images/download.svg) ](https://bintray.com/kefirsf/plugins/asynchronous-mail/_latestVersion) [![OpenHUB](https://openhub.net/p/grails-asynchronous-mail/widgets/project_thin_badge?format=gif)](https://openhub.net/p/grails-asynchronous-mail)
4+
[![Build](https://github.com/gpc/grails-asynchronous-mail/actions/workflows/build.yml/badge.svg)](https://github.com/gpc/grails-asynchronous-mail/actions/workflows/build.yml)
55

66
Description
77
-----------
@@ -11,28 +11,36 @@ database with Grails domain classes and sends them by a scheduled Quartz job. Ma
1111
the `sendAsynchronousMail` (or `sendMail`) method returning instantly, is not waiting for the mail to be actually sent. If
1212
the SMTP server isn't available, or other errors occur, the plugin can be set to retry later.
1313

14-
The plugin depends on the [quartz](https://grails.org/plugins.html#plugin/quartz) and the [mail](https://grails.org/plugins.html#plugin/mail) plugins. You also need a persistence provider plugin, [hibernate4](https://grails.org/plugins.html#plugin/hibernate4) and [mongodb](https://grails.org/plugins.html#plugin/mongodb) are supported.
14+
The plugin depends on the [quartz](https://plugins.grails.org/plugin/grails/quartz) and the [mail](https://plugins.grails.org/plugin/grails/mail) plugins. You also need a persistence provider plugin, [hibernate5](https://plugins.grails.org/plugin/grails/hibernate5) (or the appropriate version of hibernate for previous grails versions) and [mongodb](https://plugins.grails.org/plugin/grails/mongodb) are supported.
1515

1616
Links
1717
-----
1818

19-
* The plugin page: <https://grails.org/plugins.html#plugin/asynchronous-mail>
20-
* The VCS repository (GitHub): <https://github.com/kefirfromperm/grails-asynchronous-mail>
21-
* The issue tracker (GitHub): <https://github.com/kefirfromperm/grails-asynchronous-mail/issues>
22-
* The repository package (BinTray): <https://bintray.com/kefirsf/plugins/asynchronous-mail/>
23-
* The page at OpenHUB: <https://www.openhub.net/p/grails-asynchronous-mail>
19+
* The plugin page: <https://plugins.grails.org/plugin/grails/asynchronous-mail>
20+
* The VCS repository (GitHub): <https://github.com/gpc/grails-asynchronous-mail>
21+
* The issue tracker (GitHub): <https://github.com/gpc/grails-asynchronous-mail/issues>
2422

2523
Installation
2624
------------
2725

28-
To install just add the plugin to the plugins block of `build.gradle`. For Grails 3.3.x
26+
To install just add the plugin to the plugins block of `build.gradle`:
2927

28+
For Grails 5.x.x
29+
```groovy
30+
implementation "org.grails.plugins:asynchronous-mail:3.1.0"
31+
```
32+
33+
For grails 4.0.x
34+
```groovy
35+
compile "org.grails.plugins:asynchronous-mail:3.0.0"
36+
```
37+
38+
For Grails 3.3.x
3039
```groovy
3140
compile "org.grails.plugins:asynchronous-mail:2.0.2"
3241
```
3342

3443
For Grails 3.2.11 and earlier
35-
3644
```groovy
3745
compile "org.grails.plugins:asynchronous-mail:2.0.2-3.2.x"
3846
```
@@ -52,12 +60,12 @@ asynchronous.mail.send.immediately=true
5260
asynchronous.mail.clear.after.sent=false
5361
asynchronous.mail.disable=false
5462
asynchronous.mail.useFlushOnSave=true
55-
asynchronous.mail.persistence.provider='hibernate4' // Possible values are 'hibernate', 'hibernate4', 'mongodb'
63+
asynchronous.mail.persistence.provider='hibernate5' // Possible values are 'hibernate', 'hibernate4', 'hibernate5', 'mongodb'
5664
asynchronous.mail.newSessionOnImmediateSend=false
5765
asynchronous.mail.taskPoolSize=1
5866
```
5967

60-
If you want to change this options just add options which you want to change to your configuration file `/grails-app/conf/application.groovy`.
68+
If you want to change this options just add options which you want to change to your configuration file `/grails-app/conf/application.groovy` or `/grails-app/conf/application.yml`.
6169

6270
|Option|Default|Description|
6371
|------|-------|-----------|
@@ -70,16 +78,16 @@ If you want to change this options just add options which you want to change to
7078
|`asynchronous.mail.clear.after.sent`|`false`|If `true` then all messages will be deleted after sent. If `attachments` then attachments of all messages will be deleted.|
7179
|`asynchronous.mail.disable`|`false`|If true then jobs aren't started.|
7280
|`asynchronous.mail.useFlushOnSave`|`true`|By default the plugin flushes all changes to the DB on every step of the sending process for prevent resending but it makes overhead. So you can set this property to `false` and it will have better performance but will not have guarantee of prevention of resending.|
73-
|`asynchronous.mail.persistence.provider`|`hibernate4`|The persistence provider. Possible values are `hibernate`, `hibernate3`, `hibernate4`, `hibernate5`, `mongodb`.|
81+
|`asynchronous.mail.persistence.provider`|`hibernate5`|The persistence provider. Possible values are `hibernate`, `hibernate3`, `hibernate4`, `hibernate5`, `mongodb`.|
7482
|`asynchronous.mail.newSessionOnImmediateSend`|`false`|If `true` the new DB session will be created for storing a message into DB. It's needed if you want to send an email in case of error when all changes in DB are rolled back.|
7583
|`asynchronous.mail.taskPoolSize`|`1`|Max count of parallel tasks for sending messages concurrently.|
7684

77-
Configure the [mail](https://grails.org/plugins.html#plugin/mail) plugin. The Asynchronous Mail plugin uses the [mail](https://grails.org/plugins.html#plugin/mail) plugin for sending messages to the SMTP server.
85+
Configure the [mail](https://plugins.grails.org/plugin/grails/mail) plugin. The Asynchronous Mail plugin uses the [mail](https://plugins.grails.org/plugin/grails/mail) plugin for sending messages to the SMTP server.
7886

7987
Usage
8088
-----
8189

82-
If you already used the [mail](https://grails.org/plugins.html#plugin/mail) plugin, you have to import class `AsynchronousMailService` to your class.
90+
If you already used the [mail](https://plugins.grails.org/plugin/grails/mail) plugin, you have to import class `AsynchronousMailService` to your class.
8391

8492
```groovy
8593
import grails.plugin.asyncmail.AsynchronousMailService
@@ -105,22 +113,22 @@ Next, change your sendMail call.
105113
asyncMailService.sendMail {
106114
// Mail parameters
107115
108-
subject 'Test';
109-
html '<body><u>Test</u></body>';
110-
attachBytes 'test.txt', 'text/plain', byteBuffer;
116+
subject 'Test'
117+
html '<body><u>Test</u></body>'
118+
attachBytes 'test.txt', 'text/plain', byteBuffer
111119
112120
// Additional asynchronous parameters (optional)
113121
beginDate new Date(System.currentTimeMillis()+60000) // Starts after one minute, default current date
114122
endDate new Date(System.currentTimeMillis()+3600000) // Must be sent in one hour, default infinity
115-
maxAttemptsCount 3; // Max 3 attempts to send, default 1
116-
attemptInterval 300000; // Minimum five minutes between attempts, default 300000 ms
117-
delete true; // Marks the message for deleting after sent
118-
immediate true; // Run the send job after the message was created
119-
priority 10; // If priority is greater then message will be sent faster
123+
maxAttemptsCount 3 // Max 3 attempts to send, default 1
124+
attemptInterval 300000 // Minimum five minutes between attempts, default 300000 ms
125+
delete true // Marks the message for deleting after sent
126+
immediate true // Run the send job after the message was created
127+
priority 10 // If priority is greater then message will be sent faster
120128
}
121129
```
122130

123-
Also see the sample application at <https://github.com/kefirfromperm/grails-asynchronous-mail-sample>.
131+
Also see the sample application at <https://github.com/kefirfromperm/grails-asynchronous-mail-sample> (Grails 3).
124132

125133
The AsynchronousMailController and views
126134
----------------------------------------
@@ -136,45 +144,31 @@ Logging
136144

137145
To enable full logging for the plugin just add the following lines to `/grails-app/conf/logback.groovy`.
138146
```groovy
139-
...
147+
//...
140148
// Enable Asynchronous Mail plugin logging
141149
logger('grails.app.jobs.grails.plugin.asyncmail', TRACE, ['STDOUT'])
142150
logger('grails.app.services.grails.plugin.asyncmail', TRACE, ['STDOUT'])
143151
logger('grails.plugin.asyncmail', TRACE, ['STDOUT'])
144152
145153
// Enable Quartz plugin logging
146154
logger('grails.plugins.quartz', DEBUG, ['STDOUT'])
147-
...
155+
//...
148156
```
149157

150158
Indexes
151159
-------
152160

153-
I recommend to create an index on the `async_mail_mess.status` column. It's result of my heuristic observations. Only DBA have to create indexes anyway.
161+
A recommendation is to create an index on the `async_mail_mess.status` column. It's result of my heuristic observations. Only DBA have to create indexes anyway.
154162

155163
Issue tracking
156164
--------------
157165

158-
You can report bugs on [GitHub](https://github.com/kefirfromperm/grails-asynchronous-mail/issues?state=open).
159-
You also can ask me questions by email [[email protected]](mailto:[email protected]).
166+
You can report bugs on [GitHub](https://github.com/gpc/grails-asynchronous-mail/issues?state=open).
167+
You also can ask questions in the [Grails Community Slack Channels](https://slack.grails.org/).
160168
Please enable logs and attach them to your issue.
161169

162-
Please review this project at [OpenHUB](https://www.openhub.net/p/grails-asynchronous-mail).
163-
164170
Contribution
165171
------------
166172

167173
If you want to contribute to the plugin just open a pull request to the repository
168-
<https://github.com/kefirfromperm/grails-asynchronous-mail>.
169-
170-
Unit tests are very very sweet things. They help us to find bugs and to modify code without adding new bugs. It's very
171-
interesting to see how they work. I like to see how they work. What is better than unit tests? More unit tests!
172-
Unit tests are good!
173-
174-
And comments... Comments are good also. They are not as good as unit tests but they are definitely good. If you known
175-
Chinese or Arabic it's good. Seriously. It's awesome! But I don't speak them. So write comments in English.
176-
177-
Donation
178-
--------
179-
180-
If you want to give me a beer just send some money to <https://www.paypal.me/kefir>
174+
<https://github.com/gpc/grails-asynchronous-mail>.

0 commit comments

Comments
 (0)