Skip to content

Commit

Permalink
test: keycloak-build
Browse files Browse the repository at this point in the history
  • Loading branch information
majkshkurti committed Sep 12, 2023
1 parent 2de0d9b commit f603e98
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/actions/pnpm-cache-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
key-4: ${{ github.sha }}
with:
path: |
${{ github.workspace }}/app/client/apps/goat/.next
${{ github.workspace }}/apps/goat/.next
**/.turbo/**
**/dist/**
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Checks"

on:
workflow_call:
outputs:
client-goat:
description: "Client goat changed"
value: ${{ jobs.checks.outputs.client-goat }}

keycloak-theme:
description: "Keycloak theme changed"
value: ${{ jobs.checks.outputs.keycloak-theme }}

storybook:
description: "Storybook changed"
value: ${{ jobs.checks.outputs.storybook }}

sha-short:
description: "Short sha"
value: ${{ jobs.checks.outputs.sha-short }}

jobs:
checks:
name: checks
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
pull-requests: read
contents: read
steps:
- name: 📥 Checkout
uses: actions/checkout@v4

- name: 📥 Checkout PR
uses: ./.github/actions/pr-git-checkout

- name: 🕵️ Detect changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
client-goat:
- 'apps/goat/**'
- 'packages/**'
- '.prettier*'
- 'pnpm-lock.yaml'
keycloak-theme:
- 'packages/keycloak-theme/**'
- 'packages/eslint-config-p4b/**'
- 'packages/prettier-config/**'
- 'packages/tsconfig/**'
- 'packages/types/**'
- 'packages/ui/**'
- '.prettier*'
- 'pnpm-lock.yaml'
storybook:
- 'apps/storybook/**'
- 'packages/ui/**'
- 'packages/eslint-config-p4b/**'
- 'packages/prettier-config/**'
- 'packages/tsconfig/**'
- 'packages/types/**'
- '.prettier*'
- 'pnpm-lock.yaml'
- name: 🕵️ Set sha-short
id: sha-short
run: echo "sha-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

outputs:
client-goat: ${{ steps.changes.outputs.client-goat }}
keycloak-theme: ${{ steps.changes.outputs.keycloak-theme }}
storybook: ${{ steps.changes.outputs.storybook }}
sha-short: ${{ steps.sha-short.outputs.sha-short }}
57 changes: 57 additions & 0 deletions .github/workflows/keycloak-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Keycloak Theme Build"

on:
workflow_call:
inputs:
keycloak-theme-artifact-id:
description: "Keycloak theme artifact id"
required: false
type: string
default: "p4b-keycloak-theme"

push:
description: "Push to S3"
required: false
type: boolean
default: false

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: 📥 Checkout
uses: actions/checkout@v4

- name: 📥 Checkout PR
uses: goat-community/.github/.github/actions/pr-git-checkout@main

- name: 📥 Monorepo install
uses: goat-community/.github/.github/actions/pnpm-install@main
with:
enable-corepack: true
cwd: ${{ github.workspace }}

- name: 🏗️ Keycloak build
shell: bash
run: |
cd ${{github.workspace}}/packages/keycloak-theme
KEYCLOAKIFY_ARTIFACT_ID="${{ github.event.inputs.keycloak-theme-artifact-id }}" KEYCLOAKIFY_GROUP_ID="com.plan4better.auth.keycloak" pnpm run build-keycloak-theme
mv build_keycloak/target/*.jar build_keycloak/target/${{github.event.inputs.keycloak-theme-artifact-id}}.jar
- uses: aws-actions/configure-aws-credentials@v1
name: 📥 Configure AWS credentials
if: ${{ github.event.inputs.push }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name:
if: ${{ github.event.inputs.push }}
shell: bash
run: |
cd ${{github.workspace}}/packages/keycloak-theme
aws s3 cp build_keycloak/target/${{github.event.inputs.keycloak-theme-artifact-id}}.jar s3://plan4better-assets/other/keycloak/
27 changes: 17 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ on:
merge_group:
workflow_dispatch:


concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true


jobs:
file-changes:
name: file-changes
uses: ./.github/workflows/checks.yml
secrets: inherit

pr-base:
name: pr-base
Expand All @@ -46,21 +48,26 @@ jobs:
name: lint
uses: ./.github/workflows/lint.yml
secrets: inherit


build:
name: build
build-goat:
name: build
if: ${{ needs.file-changes.outputs.client-goat == 'true' || needs.file-changes.outputs.storybook == 'true' }}
uses: ./.github/workflows/production-build.yml
secrets: inherit

analyze:
name: analyze
needs: build
analyze-goat:
name: analyze-goat
needs: build-goat
uses: ./.github/workflows/nextjs-bundle-analysis.yml
secrets: inherit


build-keycloak:
name: build-keycloak
if: ${{ needs.file-changes.outputs.keycloak-theme == 'true' }}
uses: ./.github/workflows/keycloak-build.yml

required:
needs: [lint, typecheck, build]
needs: [lint, typecheck, build-goat, analyze-goat, build-keycloak]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
enable-corepack: true
cwd: ${{ github.workspace }}

- name: 🏗️ Monorepo build
- name: 🏗️ GOAT build
uses: ./.github/actions/pnpm-cache-build
with:
cwd: ${{ github.workspace }}
40 changes: 37 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ name: "Release"

on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
release-docker:
name: release
file-changes:
name: file-changes
uses: ./.github/workflows/checks.yml
secrets: inherit

release-docker-goat:
name: release-docker-goat
if: ${{ needs.file-changes.outputs.client-goat == 'true' }}
uses: goat-community/.github/.github/workflows/reusable-docker-build.yml@main
permissions:
contents: read
Expand All @@ -27,3 +32,32 @@ jobs:
file: ${{ github.workspace }}/apps/goat/Dockerfile
image-names: |
goatcommunity/goat-frontend
release-docker-storybook:
name: release-docker-storybook
if: ${{ needs.file-changes.outputs.storybook == 'true' }}
uses: goat-community/.github/.github/workflows/reusable-docker-build.yml@main
permissions:
contents: read
packages: write
pull-requests: write
secrets:
dockerhub-username: ${{ secrets.DOCKER_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_PASSWORD }}
with:
dockerhub-enable: true
ghcr-enable: false
push: ${{ github.event_name != 'pull_request' }}
file: ${{ github.workspace }}/apps/storybook/Dockerfile
image-names: |
goatcommunity/goat-storybook
release-keycloak-theme:
name: release-keycloak-theme
if: ${{ needs.file-changes.outputs.keycloak-theme == 'true' }}
uses: ./.github/workflows/keycloak-build.yml
secrets: inherit
with:
keycloak-theme-artifact-id: "p4b-keyclok-theme-${{ needs.file-changes.outputs.sha-short}}"
push: true
3 changes: 2 additions & 1 deletion apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"clean": "rimraf ./.next ./out ./coverage ./tsconfig.tsbuildinfo ./node_modules",
"dev": "storybook dev -p 6006",
"typecheck": "tsc --project ./tsconfig.json --pretty --noEmit"
"typecheck": "tsc --project ./tsconfig.json --pretty --noEmit",
"build": "storybook build"
},
"dependencies": {
"@p4b/keycloak-theme": "*",
Expand Down
1 change: 1 addition & 0 deletions packages/keycloak-theme/src/stories/Error.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export const WithAnotherMessage: StoryFn<typeof PageStory> = () => (
}}
/>
);

0 comments on commit f603e98

Please sign in to comment.