ToolJet/.github/workflows/cloud-frontend.yml
Adish M c99e7dd856
fix: Restore authorization check in cloud frontend deployment workflow (#13195)
* fix: Restore authorization check in cloud frontend deployment workflow

* fix: Reinstate branch prefix validation in cloud frontend deployment workflow

* fix: Enhance Netlify deployment step for cleaner output

* fix: Update cloud frontend deployment workflow for improved clarity and authorization checks

* Remove deployment completion message from cloud frontend workflow

* Remove branch prefix validation from cloud frontend deployment workflow
2025-07-04 17:46:30 +05:30

62 lines
2.2 KiB
YAML

name: Deploy to cloud frontend
on:
workflow_dispatch:
inputs:
branch:
description: 'Git branch to deploy (must start with "lts-", e.g., lts-3.6)'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check user 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: Checkout code (with submodules)
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
token: ${{ secrets.TOKEN_PR }}
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 22.15.1
- name: Install dependencies
run: npm install
- 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 }}
GOOGLE_MAPS_API_KEY: ${{ secrets.CLOUD_GOOGLE_MAPS_API_KEY }}
NODE_ENV: ${{ secrets.CLOUD_NODE_ENV }}
NODE_OPTIONS: ${{ secrets.CLOUD_NODE_OPTIONS }}
SENTRY_AUTH_TOKEN: ${{ secrets.CLOUD_SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.CLOUD_SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.CLOUD_SENTRY_PROJECT }}
SERVE_CLIENT: ${{ secrets.CLOUD_SERVE_CLIENT }}
SERVER_IP: ${{ secrets.CLOUD_SERVER_IP }}
TJDB_SQL_MODE_DISABLE: ${{ secrets.CLOUD_TJDB_SQL_MODE_DISABLE }}
TOOLJET_SERVER_URL: ${{ secrets.CLOUD_TOOLJET_SERVER_URL }}
TOOLJET_EDITION: cloud