Skip to content

Commit 476d38f

Browse files
committed
fix: deploy to 3 platforms and fixes private_key new line escaping
1 parent 5efd45c commit 476d38f

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

.github/workflows/front-end-bun.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ jobs:
5656
gcloud auth configure-docker europe-west1-docker.pkg.dev -q
5757
docker push "$IMAGE:$GITHUB_SHA"
5858
echo "IMAGE=$IMAGE:$GITHUB_SHA" >> $GITHUB_ENV
59+
SECRETS_ENCODED="$(jq -c . src/secrets.json | base64 -w 0)"
60+
echo "SECRETS_ENCODED=$SECRETS_ENCODED"
61+
echo "__SECRETS_ENCODED=$SECRETS_ENCODED" >> $GITHUB_ENV
5962
- name: Deploy to Cloud Run
6063
id: deploy
6164
uses: google-github-actions/deploy-cloudrun@v3
6265
with:
6366
service: front-end-bun
6467
image: ${{ env.IMAGE }}
6568
region: europe-west1
69+
env_vars: |-
70+
SECRETS_ENCODED=${{ env.SECRETS_ENCODED }}
6671
- name: 'Test output'
6772
run: 'curl "${{ steps.deploy.outputs.url }}"'

.github/workflows/front-end-deno.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ jobs:
5656
gcloud auth configure-docker europe-west1-docker.pkg.dev -q
5757
docker push "$IMAGE:$GITHUB_SHA"
5858
echo "IMAGE=$IMAGE:$GITHUB_SHA" >> $GITHUB_ENV
59+
SECRETS_ENCODED="$(jq -c . src/secrets.json | base64 -w 0)"
60+
echo "SECRETS_ENCODED=$SECRETS_ENCODED"
61+
echo "__SECRETS_ENCODED=$SECRETS_ENCODED" >> $GITHUB_ENV
5962
- name: Deploy to Cloud Run
6063
id: deploy
6164
uses: google-github-actions/deploy-cloudrun@v3
6265
with:
6366
service: front-end-deno
6467
image: ${{ env.IMAGE }}
6568
region: europe-west1
69+
env_vars: |-
70+
SECRETS_ENCODED=${{ env.SECRETS_ENCODED }}
6671
- name: 'Test output'
6772
run: 'curl "${{ steps.deploy.outputs.url }}"'

.github/workflows/front-end-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
echo "IMAGE=$IMAGE:$GITHUB_SHA" >> $GITHUB_ENV
6060
SECRETS_ENCODED="$(jq -c . src/secrets.json | base64 -w 0)"
6161
echo "SECRETS_ENCODED=$SECRETS_ENCODED"
62-
echo "SECRETS_ENCODED=$SECRETS_ENCODED" >> $GITHUB_ENV
62+
echo "__SECRETS_ENCODED=$SECRETS_ENCODED" >> $GITHUB_ENV
6363
- name: Deploy to Cloud Run
6464
id: deploy
6565
uses: google-github-actions/deploy-cloudrun@v3

front-end/src/model/git/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const githubAppAuthentication = async (githubAppId: string, clientId: string, pr
8686

8787
export const githubAuthentication = async () => {
8888

89-
const privateKey = process.env.__GITHUB_APP_PRIVATE_KEY;
89+
const privateKey = process.env.__GITHUB_APP_PRIVATE_KEY?.replace(/\\n/g, '\n');;
9090
if (!privateKey) {
9191
throw new Error("No Private Key!");
9292
}

front-end/src/model/secrets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ISecrets {
1010
key: string;
1111
};
1212

13-
const secretsEncoded = process.env.SECRETS_ENCODED;
13+
const secretsEncoded = process.env.__SECRETS_ENCODED;
1414

1515
if (!secretsEncoded) {
1616
throw new Error(`ENV VAR SECRETS Not FOUND!!`);

0 commit comments

Comments
 (0)