mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
106 lines
4.3 KiB
YAML
106 lines
4.3 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:
|
|
deploy:
|
|
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: 📥 Manual Git checkout with submodules
|
|
run: |
|
|
set -e
|
|
|
|
BRANCH="${{ github.event.inputs.branch }}"
|
|
REPO="https://x-access-token:${{ secrets.CUSTOM_GITHUB_TOKEN }}@github.com/${{ github.repository }}"
|
|
|
|
git config --global url."https://x-access-token:${{ secrets.CUSTOM_GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
|
|
git config --global http.version HTTP/1.1
|
|
git config --global http.postBuffer 524288000
|
|
|
|
echo "👉 Cloning $REPO (branch: $BRANCH)"
|
|
git clone --recurse-submodules --depth=1 --branch "$BRANCH" "$REPO" repo
|
|
cd repo
|
|
|
|
echo "🔁 Updating submodules"
|
|
git submodule update --init --recursive
|
|
|
|
echo "🔀 Attempting to checkout '$BRANCH' in each submodule and validating"
|
|
|
|
git submodule foreach --recursive bash -c "
|
|
echo '↪ '\$name': trying to checkout $BRANCH'
|
|
git fetch --all || true
|
|
git fetch origin $BRANCH:$BRANCH || echo '⚠️ '\$name': could not fetch $BRANCH'
|
|
git checkout $BRANCH || echo '⚠️ '\$name': checkout failed, staying on current branch'
|
|
CURRENT=\$(git rev-parse --abbrev-ref HEAD)
|
|
echo '✅ '\$name': now on branch '\$CURRENT
|
|
if [ \"\$CURRENT\" != \"$BRANCH\" ]; then
|
|
echo '❌ '\$name': expected $BRANCH but got '\$CURRENT
|
|
exit 1
|
|
fi
|
|
"
|
|
|
|
|
|
- name: 🧰 Setup Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 22.15.1
|
|
|
|
- name: 📦 Install dependencies
|
|
run: npm install
|
|
working-directory: repo
|
|
|
|
- name: 🛠️ Build the project
|
|
run: npm run build:plugins:prod && npm run build:frontend
|
|
working-directory: repo
|
|
env:
|
|
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
|
|
|
|
- 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 }}
|
|
working-directory: repo
|
|
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
|