diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0855c92 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: [ master, main ] + tags: [ '*' ] + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + cache: gradle + + - name: Verify Gradle + run: ./gradlew --version + + - name: Build and Test + run: ./gradlew clean check assemble --stacktrace + + - name: Publish to GitHub Packages (on tag) + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publish diff --git a/build.gradle b/build.gradle index e1b9c26..faee0e4 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ group "org.grails.plugins" apply plugin:"eclipse" apply plugin:"idea" apply plugin:"org.grails.grails-plugin" -apply plugin:"org.grails.grails-plugin-publish" +apply plugin: 'maven-publish' repositories { mavenLocal() @@ -44,20 +44,27 @@ dependencies { bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') } -// enable if you wish to package this plugin as a standalone application + bootRepackage.enabled = false findMainClass.enabled = false -grailsPublish { - if (System.getenv('BINTRAY_USER') || project.hasProperty('bintrayUser')) { - user = System.getenv('BINTRAY_USER') ?: project.property('bintrayUser') - key = System.getenv('BINTRAY_KEY') ?: project.property('bintrayKey') +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + groupId = project.group + artifactId = rootProject.name + version = project.version + } } - githubSlug = 'mrhaki/grails-x-frame-options-plugin' - license { - name = 'Apache-2.0' + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY")}") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } } - title = "X-Frame-Options Plugin" - desc = "Servlet filter that adds a X-FRAME-OPTIONS response header" - developers = [mrhaki:"Hubert A. Klein Ikkink", sergio:"Sergio del Amo Caballero", sbglasius: "Søren Berg Glasius"] }