diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..89920b0 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,31 @@ +name: Build and create an artifact + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + +jobs: + build_and_test: + name: Build and upload jar package + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'oracle' + + - name: Build project with Maven + run: mvn -B package --file pom.xml + + - uses: actions/upload-artifact@v4 + with: + name: Package + path: target/neon-plugins.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..71b7cc8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Create release artifact + +on: + release: + types: + - published + +jobs: + build_and_upload: + name: Build and upload release artifact + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'oracle' + + - name: Build project with Maven + run: mvn -B package --file pom.xml + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: 'neon-plugins.jar' + asset_path: 'target/neon-plugins.jar' + asset_content_type: 'application/java-archive' diff --git a/README.md b/README.md index cfe3a0c..b36f11a 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,6 @@ replacing the `` as appropriate Updated versions of these plugins should be shared via GitHub Releases -you must include the compiled JAR file in the release artifacts, as dependent -projects are expected to download this directly from GitHub as part of their -build pipeline +Github Action will automatically trigger and build a new version of the plugin upon Release. -[1]: https://www.keycloak.org/docs/latest/server_development/index.html#_providers \ No newline at end of file +[1]: https://www.keycloak.org/docs/latest/server_development/index.html#_providers