Files
blitzkit/.github/workflows/assets.yml
T
2025-10-23 21:49:54 -05:00

191 lines
5.9 KiB
YAML

name: Assets
on:
push:
branches: main
workflow_dispatch:
inputs:
asset_repo:
type: choice
required: false
description: What asset repo to write to
options:
- blitzkit/assets
- blitzkit/assets-preview
- blitzkit/assets-dev
default: blitzkit/assets
archive_url:
type: string
required: false
description: Archive URL to download instead of Steam client
schedule:
- cron: "0 2 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.asset_repo }}
cancel-in-progress: true
env:
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
VIDEOS_SHEET: ${{ secrets.VIDEOS_SHEET }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
WOTB_DLC_CDN: ${{ secrets.WOTB_DLC_CDN }}
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
PUBLIC_ASSET_REPO: ${{ github.event.inputs.asset_repo }}
PUBLIC_ASSET_BRANCH: main
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
ALLOW_ROBOTS: true
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
PUBLIC_PATREON_CLIENT_ID: ${{ secrets.PUBLIC_PATREON_CLIENT_ID }}
PUBLIC_PATREON_REDIRECT_URI: ${{ secrets.PUBLIC_PATREON_REDIRECT_URI }}
PATREON_CLIENT_SECRET: ${{ secrets.PATREON_CLIENT_SECRET }}
PUBLIC_NITROPAY_ID: ${{ secrets.PUBLIC_NITROPAY_ID }}
PUBLIC_DEBUG_MISSING_I18N: false
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
PUBLIC_ASSET_FAST_USER: blitzkit
PUBLIC_ASSET_FAST_REPO: assets
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
download_client:
name: Download client
runs-on: ubuntu-latest
steps:
- if: github.event.inputs.archive_url != ''
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: "true"
remove-haskell: "true"
remove-android: "true"
remove-codeql: "true"
remove-docker-images: "true"
- if: github.event.inputs.archive_url != '' && endsWith(github.event.inputs.archive_url, '.wgpkg')
run: |
sudo apt update
sudo apt install -y p7zip-full
- uses: actions/checkout@v4
if: github.event.inputs.archive_url == ''
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: arduino/setup-protoc@v3
if: github.event.inputs.archive_url == ''
with:
repo-token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
if: github.event.inputs.archive_url == ''
- run: bun run setup
if: github.event.inputs.archive_url == ''
- name: (Steam) Setup DepotDownloader
if: github.event.inputs.archive_url == ''
run: bun run setup:depotdownloader
- name: (Steam) Download client
if: github.event.inputs.archive_url == ''
run: |
chmod +x ./temp/depotDownloader/DepotDownloader
./temp/depotDownloader/DepotDownloader -q -os windows -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}"
mv depots/444202/*/* temp/game
rm -rf depots
- name: (Steam) Apply patches
if: github.event.inputs.archive_url == ''
run: bun setup:patches --manual
- name: (ZIP) Download client
if: github.event.inputs.archive_url != '' && endsWith(github.event.inputs.archive_url, '.zip')
env:
ARCHIVE_URL: ${{ github.event.inputs.archive_url }}
run: |
wget -q -O temp/archive.zip $ARCHIVE_URL
unzip -q temp/archive.zip -d temp/archive
rm temp/archive.zip
mkdir -p temp/game
mv temp/archive/app/* temp/game
- name: (WGPKG) Download client
if: github.event.inputs.archive_url != '' && endsWith(github.event.inputs.archive_url, '.wgpkg')
env:
ARCHIVE_URL: ${{ github.event.inputs.archive_url }}
run: |
mkdir -p temp/archives
mkdir -p temp/game
i=1
urls=()
while :; do
part=$(printf "%03d" $i)
url="${ARCHIVE_URL}.${part}"
if wget --spider -q "$url"; then
urls+=("$url")
((i++))
else
break
fi
done
for url in "${urls[@]}"; do
dest="temp/archives/$(basename "$url")"
wget -q -O "$dest" "$url" &
done
wait
first=$(ls temp/archives/*.001 | head -n 1)
7z x "$first" -otemp/game
rm -rf temp/archives
- name: Archive game
uses: actions/upload-artifact@v4
with:
name: game
path: temp/game
build_assets:
name: Build assets
runs-on: ubuntu-latest
needs: download_client
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- run: bun run setup
- name: Download game
uses: actions/download-artifact@v4
with:
name: game
path: temp/game
- name: AppArmor hack
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Start server and build assets
run: bun run build:assets --all-targets --manual