Skip to content

Commit

Permalink
Copy JSON secrets through files
Browse files Browse the repository at this point in the history
  • Loading branch information
yhtMinceraft1010X committed Oct 19, 2023
1 parent f8de1e9 commit 33406ba
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ jobs:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_REGION }}

# Copy the JSON secrets (Firebase configs) into JSON files
- name: Copy JSON secrets into JSON files
run: |-
printf "$FIREBASE_SERVICE_ACCOUNT" > ./firebase_service_account.json
printf "$NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG" > ./next_public_frontend_firebase_config.json
# Set the secrets that are used as env variables in the manifest files
- name: Set kubectl secrets
run: |-
kubectl create secret generic firebase-service-account \
--from-file=firebase-service-account=./firebase_service_account.json
kubectl create secret generic prisma-database-url \
--from-literal=prisma-database-url=$PRISMA_DATABASE_URL
kubectl create secret generic mongo-atlas-url \
--from-literal=mongo-atlas-url=$MONGO_ATLAS_URL
kubectl create secret generic frontend-firebase-config \
--from-file=frontend-firebase-config=./next_public_frontend_firebase_config.json
# Remove the JSON files
- name: Delete JSON files
if: ${{ always() }}
run: |-
rm ./firebase_service_account.json
rm ./next_public_frontend_firebase_config.json
# Install the dependencies such as prisma
- name: Install dependencies with immutable lockfile
run: yarn install --frozen-lockfile
Expand All @@ -72,18 +97,6 @@ jobs:
./build-prod-images.sh
working-directory: ./deployment

# Set the secrets that are used as env variables in the manifest files
- name: Set kubectl secrets
run: |-
kubectl create secret generic firebase-service-account \
--from-literal=firebase-service-account=$FIREBASE_SERVICE_ACCOUNT
kubectl create secret generic prisma-database-url \
--from-literal=prisma-database-url=$PRISMA_DATABASE_URL
kubectl create secret generic mongo-atlas-url \
--from-literal=mongo-atlas-url=$MONGO_ATLAS_URL
kubectl create secret generic frontend-firebase-config \
--from-literal=frontend-firebase-config=$NEXT_PUBLIC_FRONTEND_FIREBASE_CONFIG
# Deploy the Docker images to the GKE cluster
- name: Deploy production application
run: |-
Expand Down

0 comments on commit 33406ba

Please sign in to comment.