diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 78b73871..5c257dc1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -45,6 +45,15 @@ jobs: - name: Generate AUTH_SECRET run: echo "AUTH_SECRET=$(openssl rand -hex 32)" >> $GITHUB_ENV + # https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser + - + name: Generate NEXT_PUBLIC_OIDC_SERVER_URL + run: | + if [ "${{ github.event_name }}" == "push" ]; then + echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV + else + echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV + fi - name: Build Docker images uses: docker/bake-action@v5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06a71922..f8b1e6dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,6 +106,8 @@ jobs: POSTGRES_PASSWORD: aae5bf316ef5fe87ad806c6a9240fff68bcfdaf7 KEYCLOAK_POSTGRES_PASSWORD: 26d7f630f1524eb210bbf496443f2038a9316e9e KEYCLOAK_ADMIN_PASSWORD: 2f31e2fad93941b818449fd8d57fd019b6ce7fa5 + # https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser + NEXT_PUBLIC_OIDC_SERVER_URL: https://localhost/oidc/realms/demo # https://docs.docker.com/compose/environment-variables/envvars/#compose_file COMPOSE_FILE: compose.yaml:compose.prod.yaml:compose.e2e.yaml steps: diff --git a/compose.prod.yaml b/compose.prod.yaml index 376c9898..fa762fea 100644 --- a/compose.prod.yaml +++ b/compose.prod.yaml @@ -18,6 +18,7 @@ services: target: prod args: AUTH_SECRET: ${AUTH_SECRET} + NEXT_PUBLIC_OIDC_SERVER_URL: ${NEXT_PUBLIC_OIDC_SERVER_URL} environment: AUTH_SECRET: ${AUTH_SECRET}