name: Website Zephyr Deploy on: pull_request: types: [opened, synchronize, reopened, closed] branches: [main] paths: - 'apps/website-new/**' - 'packages/rspress-plugin/**' - 'package.json' - 'pnpm-lock.yaml' - 'turbo.json' - '.github/workflows/website-zephyr.yml' release: types: [released] workflow_dispatch: permissions: contents: read pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: SITE_ORIGIN: https://module-federation.io ZE_FAIL_BUILD: true ZE_SECRET_TOKEN: ${{ secrets.ZE_SECRET_TOKEN }} ZE_WAIT_FOR_DEPLOYMENTS: true jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout Repository uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 with: fetch-depth: 0 - name: Setup pnpm uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 - name: Setup Node.js 24 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version: '24' cache: 'pnpm' cache-dependency-path: '**/pnpm-lock.yaml' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Restore Turborepo cache uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: .turbo/cache key: ${{ runner.os }}-turbo-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-turbo-${{ github.ref_name }}- ${{ runner.os }}-turbo- - name: Use production Zephyr environment if: ${{ github.event_name == 'release' }} run: echo "ZE_ENV=production" >> "$GITHUB_ENV" - name: Build and deploy website with Zephyr if: ${{ env.ZE_SECRET_TOKEN != '' && github.event.action != 'closed' }} env: # Zephyr's debug output includes account details, so only print it # when a run is re-run with debug logging. DEBUG: ${{ runner.debug == '1' && 'zephyr*' || '' }} run: pnpm run build:website - name: Update Zephyr preview environment if: ${{ env.ZE_SECRET_TOKEN != '' && github.event_name == 'pull_request' }} uses: ZephyrCloudIO/zephyr-preview-environment-action@05822254ff8661c4e68f9dd12b83db7815ca2cf8 # v1.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Skip Zephyr deploy without token if: ${{ env.ZE_SECRET_TOKEN == '' }} run: echo "ZE_SECRET_TOKEN is not available for this workflow run; skipping Zephyr deploy."