name: Website on: push: branches: - main - production pull_request: schedule: - cron: "0 4 * * *" workflow_dispatch: inputs: branch: description: Branch type: choice required: true default: production options: - production - main environment: description: Environment type: choice required: true default: production options: - development - beta - production - preview - opentest client_provider: description: Client provider type: choice required: true default: wgc options: - wgc - steam - zip - wgpkg client_source: description: Client source type: string required: true default: 444200/windows permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ inputs.environment || github.ref }} cancel-in-progress: true env: # workflow HAS_ROOT_REPO_CONTEXT: ${{ github.event_name != 'pull_request' }} # client STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} CLIENT_PROVIDER: ${{ inputs.client_provider || (github.event_name != 'pull_request' && 'steam' || 'wgc') }} CLIENT_SOURCE: ${{ inputs.client_source || '444200/windows' }} CLIENT_DIR: ../../temp/game # blitzkit PUBLIC_ENVIRONMENT: ${{ inputs.environment || 'production' }} PUBLIC_PROMOTE_OPENTEST: false PUBLIC_STATIC_ASSET_BASE: https://assets.blitzkit.app PUBLIC_GUIDE_WEBSITE: https://guidesblitz.com # google PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} # wargaming PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} jobs: build: name: Build website runs-on: ubuntu-latest strategy: fail-fast: true matrix: chunk: [default, api, models_tanks, models_legendary, models_maps] steps: - name: Free disk space uses: jlumbroso/free-disk-space@main - name: Checkout uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha || inputs.branch || 'production' }} submodules: false token: ${{ secrets.GH_TOKEN || github.token }} # Future proofing for Reforged: we'll have both closed and open repos, so # we need to handle them here instead of disabling submodules outright - name: Checkout submodules run: | if [ "$HAS_ROOT_REPO_CONTEXT" = "true" ]; then git submodule update --init --recursive --depth=1 else git submodule update --init --recursive --depth=1 -- . ':!packages/closed' fi - name: Setup bun uses: oven-sh/setup-bun@v2 - name: Setup protoc uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GH_TOKEN }} - name: Setup CLIs run: | sudo apt-get update sudo apt-get install -y aria2 libarchive-tools - name: Set up script run: scripts/setup.sh - name: Lint run: scripts/lint.sh - name: Build protos run: bun run build-protos - name: Download client run: scripts/download-client.sh - name: Download SmartDLC if: ${{ env.HAS_ROOT_REPO_CONTEXT == 'true' }} run: scripts/download-smart-dlc.sh - name: Build run: scripts/build-website.sh env: CHUNK: ${{ matrix.chunk }} - name: Upload artifact id: upload uses: actions/upload-artifact@v4 with: name: chunk-${{ matrix.chunk }} path: dist/website - name: Trigger deployment # workflow should trigger if: # - is by cron and is on main: triggering to production # - is by push and is on production: triggering to production # - is by manual and is on anything: triggering to anything if: >- ${{ env.HAS_ROOT_REPO_CONTEXT == 'true' || (github.event_name == 'schedule' && github.ref == 'refs/heads/main') || (github.event_name == 'push' && github.ref == 'refs/heads/production') || (github.event_name == 'workflow_dispatch') }} env: TOKEN: ${{ secrets.GH_NODE_DEPLOY_TOKEN }} CHUNK: ${{ matrix.chunk }} run: | ENV_FILE="environments/${PUBLIC_ENVIRONMENT}.json" TARGET_REPO=$(jq -r ".nodes.\"$CHUNK\"" "$ENV_FILE") if [ "$TARGET_REPO" == "null" ] || [ -z "$TARGET_REPO" ]; then exit 1 fi curl \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $TOKEN" \ "https://api.github.com/repos/$TARGET_REPO/dispatches" \ -d "{ \"event_type\": \"deploy-pages\", \"client_payload\": { \"source_repo\": \"${{ github.repository }}\", \"run_id\": \"${{ github.run_id }}\", \"artifact_id\": \"${{ steps.upload.outputs.artifact-id }}\", \"chunk\": \"$CHUNK\" } }"