ToolJet/.github/workflows/render-preview-deploy.yml
Akshay 2d08d889de
Release: Community changes (v2.34.0) (#9226)
* add custom resolvers info and editable row selection info (#9057)

* fix system requirements icon

* add auth info for webhooks and fix casing

* add regex custom validation info (#9068)

* [docs]: Marketplace 1.7 updates (#9085)

* [docs] Amazon redshift plugin

* make minor improvements

* add and update docs for marketplace 1.7

* update order of plugins in overview to match sidebar

* create new version

---------

Co-authored-by: Shubhendra <withshubh@gmail.com>

* add the latest version in the versions.json file (#9094)

* [docs]: Update PDF component (#9088)

* update PDF component

* merged with develop and added changes to the new version

* update docs favicon: (#9118)

* [docs] SSO revamp (#9031)

* add method to set default language

* update image settings through custom css and update screenshots for getting started and tooljet concepts (#9158)

* fix read documentation button

* fix formatting for setup icons (#9172)

* fix sidebar link for aws lambda

* Update static media (#9175)

* updated the screenshots

* reduced the gif size

* reverted the package.json file

* edited the zoomed in images and replaced some gifs with screenshots

* removed one gif

* update static media

* update file names

* update toolbar

* fix file names

* fix: dynamodb img path

* update media for org management dashboard

* fix: casing and formatting

* update workspace constant media

* update media in workspace settings and github

* update github sso

* minor change to github sso docs

* minor fix

* update google sso

* change includeCurrentVersion flag to false

---------

Co-authored-by: Asjad Ahmed Khan <iitasjad2001@gmail.com>
Co-authored-by: Asjad Ahmed Khan <60435499+2001asjad@users.noreply.github.com>
Co-authored-by: Karan Rathod <karan.altcampus@gmail.com>

* Feature: Engagespot plugin (#9012)

* feat(plugins): added engagespot plugin

* feat(docs): added engagespot plugin docs

* chore(engagespot-plugin): revised copywritings

* Feature: Databricks data source (#9174)

* plugin-created

* Databricks integration

* icon, error handling

* removed unrelated changes from marketplace and frontend package-lock.json removed runAsync and maxRows timeouts pending

* timeout implementation

* socket timeout and error handling

* resolve comments

* resolve comments2

* solved render issue test connection improvements

* solved undefined error

* fix TJDB not null value fail for is operation (#9055)

* fix TJDB not null value fail for is operation

* handling not null and null case insenstive values

* Support for marketplace plugin deploy on render preview app (#9221)

* Fix for marketplace error on render preview app

* add marketplace build command

* Adding new workflow for building marketplace plugin

* removed render app creation

* [:docs] Add documentation for Databricks plugin (#9224)

* add docs for databricks

* update databricks docs

* update docs

* remove ref to clusters

* bump to v2.34.0

* Fixed data source cypress failure (#9227)

* updated spec with required text

* updated mongodb and import spec

* updated import spec

---------

Co-authored-by: Karan Rathod <karan.altcampus@gmail.com>
Co-authored-by: Adish M <44204658+adishM98@users.noreply.github.com>
Co-authored-by: Midhun G S <gsmithun4@gmail.com>
Co-authored-by: Shubhendra <withshubh@gmail.com>
Co-authored-by: Aman Regu <amanregu@gmail.com>
Co-authored-by: Asjad Ahmed Khan <iitasjad2001@gmail.com>
Co-authored-by: Asjad Ahmed Khan <60435499+2001asjad@users.noreply.github.com>
Co-authored-by: Jobin Jose <129726530+jobin-logidots@users.noreply.github.com>
Co-authored-by: Syed Mohammad Akhtar Rizvi <85864291+ShazanRizvi@users.noreply.github.com>
Co-authored-by: blank0537 <111295371+blank0537@users.noreply.github.com>
Co-authored-by: Mekhla Asopa <59684099+Mekhla-Asopa@users.noreply.github.com>
2024-03-29 19:13:26 +05:30

344 lines
12 KiB
YAML

name: Render review deploy
on:
pull_request_target:
types: [labeled, unlabeled, closed]
env:
PR_NUMBER: ${{ github.event.number }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
permissions:
pull-requests: write
issues: write
jobs:
create-review-app:
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'create-review-app' }}
runs-on: ubuntu-latest
steps:
- name: Create deployment
id: create-deployment
run: |
export RESPONSE=$(curl --request POST \
--url https://api.render.com/v1/services \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer ${{ secrets.RENDER_API_KEY }}' \
--data '
{
"autoDeploy": "yes",
"branch": "${{ env.BRANCH_NAME }}",
"name": "ToolJet PR #${{ env.PR_NUMBER }}",
"notifyOnFail": "default",
"ownerId": "tea-caeo4bj19n072h3dddc0",
"repo": "${{ github.event.pull_request.head.repo.git_url }}",
"slug": "tooljet-pr-${{ env.PR_NUMBER }}",
"suspended": "not_suspended",
"suspenders": [],
"type": "web_service",
"envVars": [
{
"key": "PG_HOST",
"value": "${{ secrets.RENDER_PG_HOST }}"
},
{
"key": "PG_PORT",
"value": "5432"
},
{
"key": "PG_USER",
"value": "${{ secrets.RENDER_PG_USER }}"
},
{
"key": "PG_PASS",
"value": "${{ secrets.RENDER_PG_PASS }}"
},
{
"key": "PG_DB",
"value": "${{ env.PR_NUMBER }}"
},
{
"key": "ENABLE_TOOLJET_DB",
"value": "true"
},
{
"key": "TOOLJET_DB",
"value": "${{ env.PR_NUMBER }}"
},
{
"key": "TOOLJET_DB_HOST",
"value": "${{ secrets.RENDER_PG_HOST }}"
},
{
"key": "TOOLJET_DB_USER",
"value": "${{ secrets.RENDER_PG_USER }}"
},
{
"key": "TOOLJET_DB_PASS",
"value": "${{ secrets.RENDER_PG_PASS }}"
},
{
"key": "TOOLJET_DB_PORT",
"value": "5432"
},
{
"key": "PGRST_DB_URI",
"value": "postgres://${{ secrets.RENDER_PG_USER }}:${{ secrets.RENDER_PG_PASS }}@${{ secrets.RENDER_PG_HOST }}/${{ env.PR_NUMBER }}"
},
{
"key": "PGRST_HOST",
"value": "127.0.0.1:3000"
},
{
"key": "PGRST_JWT_SECRET",
"value": "r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj"
},
{
"key": "PGRST_LOG_LEVEL",
"value": "info"
},
{
"key": "PORT",
"value": "80"
},
{
"key": "TOOLJET_HOST",
"value": "https://tooljet-pr-${{ env.PR_NUMBER }}.onrender.com"
},
{
"key": "DISABLE_TOOLJET_TELEMETRY",
"value": "true"
},
{
"key": "SMTP_ADDRESS",
"value": "smtp.mailtrap.io"
},
{
"key": "SMTP_DOMAIN",
"value": "smtp.mailtrap.io"
},
{
"key": "SMTP_PORT",
"value": "2525"
},
{
"key": "SMTP_USERNAME",
"value": "${{ secrets.RENDER_SMTP_USERNAME }}"
},
{
"key": "SMTP_PASSWORD",
"value": "${{ secrets.RENDER_SMTP_PASSWORD }}"
},
{
"key": "ENABLE_MARKETPLACE_FEATURE",
"value": "true"
},
{
"key": "TOOLJET_MARKETPLACE_URL",
"value": "${{ secrets.MARKETPLACE_BUCKET }}"
}
],
"serviceDetails": {
"disk": null,
"env": "docker",
"envSpecificDetails": {
"dockerCommand": "",
"dockerContext": "./",
"dockerfilePath": "./docker/preview.Dockerfile"
},
"healthCheckPath": "/api/health",
"numInstances": 1,
"openPorts": [{
"port": 80,
"protocol": "TCP"
}],
"plan": "starter",
"pullRequestPreviewsEnabled": "no",
"region": "oregon",
"url": "https://tooljet-pr-${{ env.PR_NUMBER }}.onrender.com"
}
}')
echo "response: $RESPONSE"
export SERVICE_ID=$(echo $RESPONSE | jq -r '.service.id')
echo "SERVICE_ID=$SERVICE_ID" >> $GITHUB_ENV
- name: Comment deployment URL
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Deployment: https://tooljet-pr-${{ env.PR_NUMBER }}.onrender.com \n Dashboard: https://dashboard.render.com/web/${{ env.SERVICE_ID }}'
})
- uses: actions/github-script@v6
with:
script: |
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'create-review-app'
})
} catch (e) {
console.log(e)
}
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['active-review-app']
})
destroy-review-app:
if: ${{ (github.event.action == 'labeled' && github.event.label.name == 'destroy-review-app') || github.event.action == 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Delete service
run: |
export SERVICE_ID=$(curl --request GET \
--url 'https://api.render.com/v1/services?name=ToolJet%20PR%20%23${{ env.PR_NUMBER }}&limit=1' \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}' | \
jq -r '.[0].service.id')
curl --request DELETE \
--url https://api.render.com/v1/services/$SERVICE_ID \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}'
- uses: actions/github-script@v6
with:
script: |
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'destroy-review-app'
})
} catch (e) {
console.log(e)
}
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'suspend-review-app'
})
} catch (e) {
console.log(e)
}
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'active-review-app'
})
} catch (e) {
console.log(e)
}
- name: Install PostgreSQL client
run: |
sudo apt update
sudo apt install postgresql-client -y
- name: Wait after installing PostgreSQL
run: sleep 25
- name: Drop PostgreSQL PR database
env:
PGHOST: ${{ secrets.RENDER_DS_PG_HOST }}
PGPORT: 5432
PGUSER: ${{ secrets.RENDER_DS_PG_USER }}
PGDATABASE: ${{ env.PR_NUMBER }}
run: |
if PGPASSWORD=${{ secrets.RENDER_DS_PG_PASS }} psql -h $PGHOST -p $PGPORT -U $PGUSER -lqt | cut -d \| -f 1 | grep -qw $PGDATABASE; then
echo "Database $PGDATABASE exists, deleting..."
PGPASSWORD=${{ secrets.RENDER_DS_PG_PASS }} psql -h $PGHOST -p $PGPORT -U $PGUSER -d postgres -c "drop database \"$PGDATABASE\" ;"
else
echo "Database $PGDATABASE does not exist."
fi
suspend-review-app:
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'suspend-review-app' }}
runs-on: ubuntu-latest
steps:
- name: Suspend service
run: |
export SERVICE_ID=$(curl --request GET \
--url 'https://api.render.com/v1/services?name=ToolJet%20PR%20%23${{ env.PR_NUMBER }}&limit=1' \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}' | \
jq -r '.[0].service.id')
curl --request POST \
--url https://api.render.com/v1/services/$SERVICE_ID/suspend \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}'
- uses: actions/github-script@v6
with:
script: |
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'active-review-app'
})
} catch (e) {
console.log(e)
}
resume-review-app:
if: ${{ github.event.action == 'unlabeled' && github.event.label.name == 'suspend-review-app' }}
runs-on: ubuntu-latest
steps:
- name: Resume service
run: |
export SERVICE_ID=$(curl --request GET \
--url 'https://api.render.com/v1/services?name=ToolJet%20PR%20%23${{ env.PR_NUMBER }}&limit=1' \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}' | \
jq -r '.[0].service.id')
curl --request POST \
--url https://api.render.com/v1/services/$SERVICE_ID/resume \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}'
- uses: actions/github-script@v6
with:
script: |
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['active-review-app']
})
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'suspend-review-app'
})
} catch (e) {
console.log(e)
}