name: Website on: pull_request: branches: - main - base paths: - packages/website/** - packages/client/src/styles/variables.scss - package.json - package-lock.json - tsconfig.website.json - vite.config.website.ts - .github/workflows/website-deploy.yml workflow_run: workflows: - Publish Desktop Artifacts to Release types: - completed workflow_dispatch: permissions: contents: read concurrency: group: website-${{ github.event.pull_request.number || github.event.workflow_run.id || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: name: Build website if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest steps: - name: Checkout repository if: github.event_name != 'workflow_run' uses: actions/checkout@v4 - name: Checkout desktop release ref if: github.event_name == 'workflow_run' uses: actions/checkout@v4 with: ref: ${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }} - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 24 cache: npm cache-dependency-path: package-lock.json - name: Install dependencies run: npm ci --ignore-scripts - name: Type-check website run: npx vue-tsc -p tsconfig.website.json --noEmit - name: Build website run: npm run build:website - name: Prepare SSH if: github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' env: WEBSITE_SSH_KEY: ${{ secrets.WEBSITE_SSH_KEY }} WEBSITE_SSH_KNOWN_HOSTS: ${{ secrets.WEBSITE_SSH_KNOWN_HOSTS }} run: | test -n "$WEBSITE_SSH_KEY" mkdir -p ~/.ssh chmod 700 ~/.ssh printf '%s\n' "$WEBSITE_SSH_KEY" > ~/.ssh/website_deploy_key chmod 600 ~/.ssh/website_deploy_key if [ -n "$WEBSITE_SSH_KNOWN_HOSTS" ]; then printf '%s\n' "$WEBSITE_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts fi - name: Deploy website if: github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' env: WEBSITE_SSH_USER: ${{ secrets.WEBSITE_SSH_USER }} WEBSITE_SSH_PORT: ${{ secrets.WEBSITE_SSH_PORT }} run: | SSH_USER="${WEBSITE_SSH_USER:-root}" SSH_PORT="${WEBSITE_SSH_PORT:-22}" DEPLOY_DIR="/var/www/ekkolearnai.com/current" SSH_CMD="ssh -i ~/.ssh/website_deploy_key -p ${SSH_PORT} -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new" $SSH_CMD "$SSH_USER@154.3.33.232" "mkdir -p '$DEPLOY_DIR' && find '$DEPLOY_DIR' -mindepth 1 -maxdepth 1 -exec rm -rf {} +" tar -C dist/website -czf - . | $SSH_CMD "$SSH_USER@154.3.33.232" "tar -xzf - -C '$DEPLOY_DIR'"