From 05f0245041699c3f216c86f523eace7c94c3cec3 Mon Sep 17 00:00:00 2001 From: Helmut Wolf Date: Thu, 25 Jul 2024 11:36:13 +0200 Subject: [PATCH] CI --- .github/workflows/ci.yaml | 86 ++++++++++++--------------------------- README.md | 55 ++++--------------------- 2 files changed, 33 insertions(+), 108 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 641d957..3de39af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,73 +3,37 @@ on: push: branches: - main + tags: + - "v*.*.*" + - "v*.*.*-alpha*" + - "v*.*.*-beta*" pull_request: branches: - main -jobs: +defaults: + run: + working-directory: ./src +jobs: build: runs-on: ubuntu-latest if: github.event.head_commit.author.name != 'actions' steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2.1.3 - with: - node-version: '16' - - uses: bahmutov/npm-install@v1 - - run: yarn build - - run: npx keycloakify - - uses: actions/upload-artifact@v2 - with: - name: keycloak-theme-world-direct - path: build_keycloak/target/*keycloak-theme*.jar - - uses: actions/upload-artifact@v2 - with: - name: build - path: build - - check_if_version_upgraded: - name: Check if version upgrade - runs-on: ubuntu-latest - needs: build - outputs: - from_version: ${{ steps.step1.outputs.from_version }} - to_version: ${{ steps.step1.outputs.to_version }} - is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} - steps: - - uses: garronej/ts-ci@v1.1.7 - id: step1 - with: - action_name: is_package_json_version_upgraded - - create_github_release: - runs-on: ubuntu-latest - needs: - - check_if_version_upgraded - # We create a release only if the version have been upgraded and we are on a default branch - # PR on the default branch can release beta but not real release - if: | - needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && - ( - github.event_name == 'push' || - needs.check_if_version_upgraded.outputs.is_release_beta == 'true' - ) - steps: - - run: mkdir jars - - uses: actions/download-artifact@v2 - with: - name: keycloak-theme-world-direct - - run: mv *keycloak-theme*.jar jars/keycloak-theme-world-direct.jar - - uses: softprops/action-gh-release@v1 - with: - name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }} - tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }} - target_commitish: ${{ github.head_ref || github.ref }} - generate_release_notes: true - files: | - jars/keycloak-theme-world-direct.jar - draft: false - prerelease: ${{ needs.check_if_version_upgraded.outputs.is_release_beta == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v4 + - name: Create jar artifact + run: | + zip -r keycloak-theme-world-direct.jar * + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: keycloak-theme-world-direct.jar + path: src/keycloak-theme-world-direct.jar + - name: Create Release when we a tag ref has been created + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + generate_release_notes: true + files: | + src/keycloak-theme-world-direct.jar + draft: true diff --git a/README.md b/README.md index 3b95b0f..06e358d 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,13 @@ # Keycloak Theme World-Direct -This repo is based on the [Keycloakify v7 starter template](https://github.com/keycloakify/keycloakify-starter) and has been (minimally) adapted to serve the needs for . +## Development -> Note: although stated in the [Standalone keycloak theme](https://github.com/keycloakify/keycloakify-starter#standalone-keycloak-theme) section, I did not perform said changes (except for the CI part) with the main reason being the ability to rebase more easily in future. +* Start keycloak, with theme caching disabled: -## Getting started + ```shell + podman machine start + podman-compose up -d + ``` -Is as simple as running: - -```shell -yarn install && yarn storybook -``` - -and seeing live updates on your screen whenever you make edits. - -### Important files - -The upstream docs state[^0] that: -> [..] customizing the [Template.tsx](src/keycloak-theme/login/Template.tsx) component alone will already cover 90% of your customization needs.[^0] - -Given this, the most important files are: - -* [Template.tsx](src/keycloak-theme/login/Template.tsx) -* [KcApp.tsx](src/keycloak-theme/login/KcApp.tsx), for adding your own CSS `classes` -* [KcApp.css](src/keycloak-theme/login/KcApp.css), for defining your styles -* fiddling with resources - -This repo's commits give good pointers, too. - -## Deployment - -* To create a new deployment, simply raise the version in [package.json](package.json); to create pre-release versions use the following versioning scheme: `0.1.2-rc.1` -* Push to the `main` branch, which in turn will automatically create a tag, generate the release notes, lint and build a `.jar` file containing the final theme -* Deploy the resulting jar file by either following the [Keycloak](https://www.keycloak.org/docs/latest/server_development/#deploying-themes) or [Red Hat SSO](https://access.redhat.com/documentation/en-us/red_hat_single_sign-on/7.6/html/server_developer_guide/themes#deploying_themes) docs. - * tl;dr: copy the resulting jar file to a certain location, e.g., `${jboss.home}/standalone/deployments/` - > Note: the latest version is **automatically picked up and deployed to ** when running the [ansible playbook](https://github.com/world-direct/redhatsso/) via `ansible-playbook site.yaml --tags themes` - -## Usages - -To reference this theme, navigate to your realm > `Realm Settings` > `Themes` and choose `keycloak-theme-world-direct` as your `Login Theme`; *optionally* you can also enable `Internationalization Enabled` and set `de` as the `Default Locale`: - -![referencing_theme_in_realm](docs/referencing_theme_in_realm.png) - -## Issues & Contributions - -Feel free to raise an issue, contributions are welcome via PRs too :-). - -## References - -* [^0]: [Keycloakify Storybook](https://storybook.keycloakify.dev) shows all the base template provided out-of-the-box by Keycloak which can be overridden -* [1]: [Keycloakify Starter](https://github.com/keycloakify/keycloakify-starter#standalone-keycloak-theme) inluding its docs and its `Use this template` possibility +* , Login: `admin`, `dev_only` +* TODO: realm-import, with realm having the theme pre-selected for easy development