ToolJet/.github/workflows/cloud-frontend.yml
Adish M 95866aed82
feat: Add GitHub Actions workflow for cloud frontend deployment (#13159)
* feat: Add GitHub Actions workflow for cloud frontend deployment

* chore: Comment out authorization checks and branch validation in deployment workflow for testing
2025-07-03 10:54:37 +05:30

75 lines
2.5 KiB
YAML

name: Deploy to cloud frontend
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to deploy (must start with lts/)'
required: true
default: 'lts/latest'
jobs:
build:
runs-on: ubuntu-latest
steps:
# - name: Check authorization
# run: |
# allowed_user1=${{ secrets.ALLOWED_USER1_USERNAME }}
# allowed_user2=${{ secrets.ALLOWED_USER2_USERNAME }}
# allowed_user3=${{ secrets.ALLOWED_USER3_USERNAME }}
# if [[ "${{ github.actor }}" != "$allowed_user1" && \
# "${{ github.actor }}" != "$allowed_user2" && \
# "${{ github.actor }}" != "$allowed_user3" ]]; then
# echo "❌ User '${{ github.actor }}' is not authorized to trigger this workflow."
# exit 1
# else
# echo "✅ User '${{ github.actor }}' is authorized."
# fi
# - name: Validate branch prefix
# run: |
# if [[ "${{ github.event.inputs.branch }}" != lts/* ]]; then
# echo "❌ Branch name must start with 'lts/'"
# exit 1
# fi
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 22.15.1
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run build:plugins:prod && npm run build:frontend
env:
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
NODE_ENV: ${{ secrets.NODE_ENV }}
NODE_OPTIONS: ${{ secrets.NODE_OPTIONS }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SERVE_CLIENT: ${{ secrets.SERVE_CLIENT }}
SERVER_IP: ${{ secrets.SERVER_IP }}
TJDB_SQL_MODE_DISABLE: ${{ secrets.TJDB_SQL_MODE_DISABLE }}
TOOLJET_SERVER_URL: ${{ secrets.TOOLJET_SERVER_URL }}
TOOLJET_EDITION: cloud
- name: Deploy to Netlify
run: |
npm install -g netlify-cli
netlify deploy --prod --dir=frontend/build --auth=$NETLIFY_AUTH_TOKEN --site=${{ secrets.CLOUD_NETLIFY_SITE_ID }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: ✅ Deployment complete
run: echo "🎉 Deployment to Netlify successful for branch ${{ github.event.inputs.branch }} by ${{ github.actor }}"