Skip to content

Commit

Permalink
Initial Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Apr 28, 2024
0 parents commit 4e7519d
Show file tree
Hide file tree
Showing 17 changed files with 838 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Grace CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
jobs:
build:
permissions:
contents: read # to fetch code (actions/checkout)
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8', '11']
env:
WORKSPACE: ${{ github.workspace }}
steps:
- name: Checkout repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Run Build
id: build
uses: gradle/gradle-build-action@v3
with:
arguments: build -x test
publish:
if: github.event_name == 'push'
needs: ["build"]
permissions:
contents: read # to fetch code (actions/checkout)
checks: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 8
- 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@v3
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
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Grace Release

on:
push:
tags:
- v*

permissions:
contents: write

jobs:
create_draft_release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Create draft release
run: |
gh release create \
--repo ${{ github.repository }} \
--title ${{ github.ref_name }} \
--notes '' \
--draft \
${{ github.ref_name }}
release_and_publish:
needs: create_draft_release
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8']
env:
GIT_USER_NAME: rainboyan
GIT_USER_EMAIL: rain@rainboyan.com
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: gradle/wrapper-validation-action@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Extract 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'`
echo $TARGET_BRANCH
echo ::set-output name=value::${TARGET_BRANCH}
- name: Set the current release version
id: release_version
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- name: Generate secring file
id: secring
env:
SECRING_FILE: ${{ secrets.SECRING_FILE }}
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
- name: Publish to Sonatype OSSRH
id: publish
if: steps.secring.outcome == 'success'
uses: gradle/gradle-build-action@v3
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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Thumbs.db
.DS_Store
.gradle
build/
out/
.idea
*.iml
*.ipr
*.iws
.project
.settings
.classpath
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[![Main branch build status](https://github.com/grace-plugins/grace-inertia/workflows/Grace%20CI/badge.svg?style=flat)](https://github.com/grace-plugins/grace-inertia/actions?query=workflow%3A%Grace+CI%22)
[![Apache 2.0 license](https://img.shields.io/badge/License-APACHE%202.0-green.svg?logo=APACHE&style=flat)](https://opensource.org/licenses/Apache-2.0)
[![Latest version on Maven Central](https://img.shields.io/maven-central/v/org.graceframework.plugins/inertia.svg?label=Maven%20Central&logo=apache-maven&style=flat)](https://search.maven.org/search?q=g:org.graceframework.plugins)

# Grace with Inertia

Grace Plugin for using Grace/Grails app with [Inertia.js](https://inertiajs.com).


## Development

### Build from source

```
git clone https://github.com/grace-plugins/grace-inertia.git
cd grace-inertia
./gradlew publishToMavenLocal
```

## Support Version

* Grace 2022.0.0+
* Grails 3.0+

## Roadmap

### 1.x

* Inertia 1.x

## License

This plugin is available as open source under the terms of the [APACHE LICENSE, VERSION 2.0](http://apache.org/Licenses/LICENSE-2.0)

## Links

- [Grace Framework](https://github.com/graceframework/grace-framework)
- [Grace Plugins](https://github.com/grace-plugins)
- [Grace Inertia Plugin](https://github.com/grace-plugins/grace-inertia)
- [Inertia](https://inertiajs.com)
44 changes: 44 additions & 0 deletions app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
grails:
profile: web-plugin
codegen:
defaultPackage: org.graceframework.plugins.inertia
gorm:
reactor:
# Whether to translate GORM events into Reactor events
# Disabled by default for performance reasons
events: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
jmx:
unique-names: true
main:
banner-mode: "console"
groovy:
template:
check-template-location: false
devtools:
restart:
additional-exclude:
- '*.gsp'
- '**/*.gsp'
- '*.gson'
- '**/*.gson'
- 'logback.groovy'
- '*.properties'
environments:
development:
management:
endpoints:
enabled-by-default: true
web:
base-path: '/actuator'
exposure:
include: '*'
production:
management:
endpoints:
enabled-by-default: false
19 changes: 19 additions & 0 deletions app/conf/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT" />
</root>
<logger name="org.hibernate.orm.deprecation" level="error" />
<logger name="org.graceframework.plugins.inertia.Application" level="debug" />
</configuration>
13 changes: 13 additions & 0 deletions app/init/org/graceframework/plugins/inertia/Application.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.graceframework.plugins.inertia

import grails.boot.Grails
import grails.plugins.metadata.PluginSource

@PluginSource
class Application {

static void main(String[] args) {
Grails.run(Application, args)
}

}
11 changes: 11 additions & 0 deletions app/init/org/graceframework/plugins/inertia/BootStrap.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.graceframework.plugins.inertia

class BootStrap {

def init = { servletContext ->
}

def destroy = {
}

}
Loading

0 comments on commit 4e7519d

Please sign in to comment.