mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
168 lines
4.6 KiB
YAML
168 lines
4.6 KiB
YAML
name: Website
|
|
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
- cron: '0 4 * * *'
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
|
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
|
# PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
|
|
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
|
|
ALLOW_ROBOTS: true
|
|
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
|
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
|
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
|
|
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
|
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
|
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
|
DEPOT_DOWNLOADER_USERNAME: ${{ secrets.DEPOT_DOWNLOADER_USERNAME }}
|
|
DEPOT_DOWNLOADER_PASSWORD: ${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}
|
|
STEAM_OS: windows
|
|
STEAM_APP: 3341250
|
|
STEAM_DEPOT: 3341251
|
|
PUBLIC_ASSET_BRANCH: ue
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
- name: Setup bun
|
|
uses: oven-sh/setup-bun@v1
|
|
|
|
- name: Configure pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 9.0
|
|
|
|
- name: Download Steam Depot
|
|
run: |
|
|
mkdir -p temp
|
|
|
|
echo "Downloading..."
|
|
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/SteamRE/DepotDownloader/releases/latest | \
|
|
grep -i "linux-x64" | \
|
|
grep "browser_download_url" | \
|
|
cut -d '"' -f 4)
|
|
curl -L "$DOWNLOAD_URL" -o temp/depotDownloader.zip
|
|
|
|
echo "Unzipping..."
|
|
unzip temp/depotDownloader.zip -d temp/depotDownloader
|
|
|
|
echo "Download complete; files:"
|
|
ls temp/depotDownloader
|
|
|
|
- name: Download dependencies
|
|
run: bun install
|
|
|
|
- name: Restore dependencies
|
|
run: |
|
|
cd src/BlitzKit.CLI
|
|
dotnet restore
|
|
|
|
- name: Download client
|
|
run: |
|
|
chmod +x temp/depotDownloader/DepotDownloader
|
|
temp/depotDownloader/DepotDownloader \
|
|
-username "${{ env.DEPOT_DOWNLOADER_USERNAME }}" \
|
|
-password "${{ env.DEPOT_DOWNLOADER_PASSWORD }}" \
|
|
-os ${{ env.STEAM_OS }} \
|
|
-app ${{ env.STEAM_APP }} \
|
|
-depot ${{ env.STEAM_DEPOT }} \
|
|
-dir temp/depot \
|
|
-filelist filelist.txt
|
|
|
|
- name: Download containers
|
|
run: |
|
|
cd src/BlitzKit.CLI
|
|
dotnet run unpack ../../temp/depot
|
|
|
|
- name: Run API and build website
|
|
run: |
|
|
cd src/BlitzKit.CLI
|
|
dotnet run api --depot --verbosepa &
|
|
SERVER_PID=$!
|
|
|
|
cd ../..
|
|
bun run buildonly:website
|
|
|
|
kill $SERVER_PID || true
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
name: build
|
|
path: dist/website
|
|
|
|
deploy-github-pages:
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
name: Deploy to GitHub Pages
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
environment:
|
|
name: Production
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|
|
|
|
deploy-vercel:
|
|
if: ${{ github.ref != 'refs/heads/main' }}
|
|
name: Deploy to Vercel
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
environment:
|
|
name: Preview
|
|
url: ${{ steps.url.outputs.url }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup bun
|
|
uses: oven-sh/setup-bun@v1
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build
|
|
path: .vercel/output/
|
|
|
|
- name: Install Vercel CLI
|
|
run: bun install --global vercel
|
|
|
|
- name: Deploy Project Artifacts to Vercel
|
|
shell: bash
|
|
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | tee deploy.log
|
|
|
|
- name: Set preview url
|
|
id: url
|
|
run: echo "url=$(tail -1 deploy.log)">> $GITHUB_OUTPUT
|