-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(embed): automate the deployment of the code embed renderer
- Loading branch information
1 parent
fa79472
commit 43ac179
Showing
12 changed files
with
11,635 additions
and
10,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Sharingan Deploy Code Embed | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
stage: | ||
default: Production | ||
options: | ||
- Production | ||
- Development | ||
description: "Environment to deploy on" | ||
required: true | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'packages/database/prisma/**' | ||
- 'packages/database/src/**' | ||
- 'apps/functions/code-embed/src/**' | ||
- 'apps/functions/code-embed/serverless.ts' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: ${{ github.event.inputs.stage }} | ||
env: | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
EMBED_STYLE_URL: ${{ secrets.EMBED_STYLE_URL }} | ||
EMBED_JS_URL: ${{ secrets.EMBED_JS_URL }} | ||
WEB_APP_URL: ${{ secrets.WEB_APP_URL }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Node 16 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install projects dependencies | ||
uses: bahmutov/npm-install@v1 | ||
|
||
- name: Deploy the application in staging | ||
working-directory: 'apps/functions/code-embed' | ||
if: ${{ github.event.inputs.stage == 'Development' }} | ||
run: | | ||
yarn setup:layer:remote | ||
yarn sls deploy --stage dev | ||
- name: Deploy the application in production | ||
working-directory: 'apps/functions/code-embed' | ||
if: ${{ github.event.inputs.stage == 'Production' }} | ||
run: | | ||
yarn setup:layer:remote | ||
yarn sls deploy --stage prod | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
DATABASE_URL="mysql:https://root:@127.0.0.1:3311/sharingan" | ||
EMBED_STYLE_URL=http:https://localhost:7502/sharingan/style.css | ||
EMBED_JS_URL=http:https://localhost:7502/sharingan/script.js | ||
EMBED_STYLE_URL=https:https://cdn.jsdelivr.net/npm/sharingan-embed@latest/style.min.css | ||
EMBED_JS_URL=https:https://cdn.jsdelivr.net/npm/sharingan-embed@latest/script.min.js | ||
WEB_APP_URL=http:https://localhost:7500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ jspm_packages | |
.turbo | ||
lib | ||
.env | ||
.esbuild/.build/src/functions/renderer/schema.prisma | ||
.env.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf layers | ||
|
||
mkdir -p layers | ||
mkdir -p layers/prisma-layer/nodejs/node_modules/@prisma | ||
mkdir -p layers/shiki-layer/nodejs/node_modules | ||
|
||
cd ../../.. | ||
|
||
yarn workspace @sharingan/database db:generate | ||
|
||
cp -r node_modules/.prisma apps/functions/code-embed/layers/prisma-layer/nodejs/node_modules | ||
|
||
if [ $1 = "remote" ]; then | ||
rm apps/functions/code-embed/layers/prisma-layer/nodejs/node_modules/.prisma/client/libquery_engine-darwin.dylib.node | ||
rm apps/functions/code-embed/layers/prisma-layer/nodejs/node_modules/.prisma/client/libquery_engine-linux-musl.so.node | ||
else | ||
echo 'local' | ||
fi | ||
|
||
cp -r node_modules/@prisma/client apps/functions/code-embed/layers/prisma-layer/nodejs/node_modules/@prisma | ||
|
||
cp -r node_modules/shiki apps/functions/code-embed/layers/shiki-layer/nodejs/node_modules | ||
cp -r node_modules/vscode-oniguruma apps/functions/code-embed/layers/shiki-layer/nodejs/node_modules | ||
cp -r node_modules/vscode-textmate apps/functions/code-embed/layers/shiki-layer/nodejs/node_modules | ||
cp -r node_modules/jsonc-parser apps/functions/code-embed/layers/shiki-layer/nodejs/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.