Skip to content

Commit 5b317a7

Browse files
chore: update deploy
1 parent 6e2d3b9 commit 5b317a7

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

.github/workflows/cd.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ jobs:
2222
permissions:
2323
contents: 'read'
2424
id-token: 'write'
25+
outputs:
26+
environment: ${{ steps.set-github-outputs.outputs.environment }}
27+
url: ${{ steps.set-github-outputs.outputs.url }}
2528
steps:
29+
-
30+
name: Sets GitHub Outputs
31+
id: set-github-outputs
32+
run: |
33+
if [ "${{ github.event_name }}" == "push" ]; then
34+
echo "environment=prod" >> "$GITHUB_OUTPUT"
35+
echo "url=https://demo.api-platform.com/" >> "$GITHUB_OUTPUT"
36+
else
37+
echo "environment=pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
38+
echo "url=https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com/" >> "$GITHUB_OUTPUT"
39+
fi
2640
-
2741
name: Checkout
2842
uses: actions/checkout@v4
@@ -51,9 +65,9 @@ jobs:
5165
name: Generate NEXT_PUBLIC_OIDC_SERVER_URL
5266
run: |
5367
if [ "${{ github.event_name }}" == "push" ]; then
54-
echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV
68+
echo "NEXT_PUBLIC_OIDC_SERVER_URL=${{ steps.set-github-outputs.outputs.url }}" >> $GITHUB_ENV
5569
else
56-
echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV
70+
echo "NEXT_PUBLIC_OIDC_SERVER_URL=${{ steps.set-github-outputs.outputs.url }}oidc/realms/demo" >> $GITHUB_ENV
5771
fi
5872
-
5973
name: Build Docker images
@@ -107,6 +121,8 @@ jobs:
107121
docker-images-version: ${{ github.sha }}
108122
gke-cluster: api-platform-demo
109123
gke-zone: europe-west1-c
124+
environment: ${{ needs.build.outputs.environment }}
125+
url: ${{ needs.build.outputs.url }}
110126
secrets:
111127
gke-credentials: ${{ secrets.GKE_SA_KEY }}
112128
gke-project: ${{ secrets.GKE_PROJECT }}

.github/workflows/deploy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ on:
1717
type: string
1818
description: Google Kubernetes Engine Zone
1919
required: true
20+
environment:
21+
type: string
22+
description: GitHub Environment
23+
required: true
24+
url:
25+
type: string
26+
description: GitHub Environment URL
27+
required: true
2028
secrets:
2129
gke-credentials:
2230
description: Google Kubernetes Engine Credentials as JSON

0 commit comments

Comments
 (0)