diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ca1db91 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM adorsys/keycloak-config-cli:5.10.0-22.0.4 + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..b964e7b --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# GitHub Action: Set Keycloak configuration + +Configures a Keycloak instance from an input configuration + +## Usage + +``` +jobs: + e2e-tests: + services: + auth-db: + image: postgres:13 + env: + POSTGRES_DB: keycloak + POSTGRES_USER: keycloak + POSTGRES_PASSWORD: password + auth: + image: keycloak/keycloak:22.0.3 + env: + KC_DB_USER: keycloak + KC_DB_PASSWORD: password + KEYCLOAK_ADMIN: admin + KEYCLOAK_ADMIN_PASSWORD: admin + ports: + - 8080:8080 + + steps: + - name: Set Keycloak configuration + uses: RosemanLabs/gha-set-keycloak-config@v1 + with: + keycloak-url: "localhost:8080" + keycloak-user: "admin" + keycloak-password: "admin" + import-files: "/config/*" +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6ba8f2a --- /dev/null +++ b/action.yml @@ -0,0 +1,23 @@ +name: "Set Keycloak configuration" +description: "Configures a Keycloak instance from an input configuration" +inputs: + keycloak-url: + description: "The URL of the Keycloak instance" + required: true + keycloak-user: + description: "The user to use for authenticating with Keycloak" + required: true + keycloak-password: + description: "The password to use for authenticating with Keycloak" + required: true + import-files: + description: "A list of files to import into Keycloak" + required: true +runs: + using: "docker" + image: "Dockerfile" + args: + - "-KEYCLOAK_URL ${{ inputs.keycloak-url }}" + - "-KEYCLOAK_USER ${{ inputs.keycloak-user }}" + - "-KEYCLOAK_PASSWORD ${{ inputs.keycloak-password }}" + - "-IMPORT_FILES ${{ inputs.import-files }}" diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..0f797e6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +java $JAVA_OPTS -jar /app/keycloak-config-cli.jar $0 $@