mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
170 lines
4.0 KiB
YAML
170 lines
4.0 KiB
YAML
name: Website
|
|
|
|
on:
|
|
push:
|
|
|
|
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: steam
|
|
|
|
options:
|
|
- steam
|
|
- zip
|
|
- wgpkg
|
|
|
|
client_source:
|
|
description: Client source
|
|
|
|
type: string
|
|
required: true
|
|
default: 444200/windows
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ inputs.environment || 'production' }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# client
|
|
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
|
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
|
CLIENT_PROVIDER: ${{ inputs.client_provider || 'steam' }}
|
|
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
|
|
|
|
# blitz
|
|
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
|
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
|
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
|
|
|
# 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]
|
|
|
|
steps:
|
|
- name: Free disk space
|
|
uses: jlumbroso/free-disk-space@main
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.branch || 'production' }}
|
|
submodules: recursive
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
- 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: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Download Client
|
|
run: bun run download-client
|
|
|
|
- name: Build
|
|
run: bun run --bun build
|
|
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
|
|
|
|
if: ${{ github.ref == 'refs/heads/production' }}
|
|
|
|
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\"
|
|
}
|
|
}"
|