mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
steam downloader
This commit is contained in:
1 parent
a438eb704f
commit
d3202e8607
7 files changed
+95
-42
No files matched your search
@@ -34,6 +34,25 @@ on:
|
||||
- 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
|
||||
|
||||
@@ -42,6 +61,13 @@ concurrency:
|
||||
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
|
||||
@@ -52,7 +78,6 @@ env:
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
||||
GAME_DIR: ../../temp/game
|
||||
|
||||
# google
|
||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
||||
@@ -60,12 +85,6 @@ env:
|
||||
# wargaming
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
|
||||
# steam
|
||||
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
||||
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
||||
STEAM_APP: 444200
|
||||
STEAM_OS: windows
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build website
|
||||
@@ -102,38 +121,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Setup DepotDownloader
|
||||
run: |
|
||||
REPO_USER="SteamRE"
|
||||
REPO_NAME="DepotDownloader"
|
||||
TEMP="temp"
|
||||
|
||||
OUT="$TEMP/$REPO_NAME"
|
||||
ZIP="$TEMP/$REPO_NAME.zip"
|
||||
|
||||
URL=$(
|
||||
curl -s "https://api.github.com/repos/$REPO_USER/$REPO_NAME/releases/latest" \
|
||||
| jq -r '.assets[]
|
||||
| select(.name | contains("linux-x64"))
|
||||
| .browser_download_url' \
|
||||
| head -n 1
|
||||
)
|
||||
|
||||
mkdir -p "$TEMP"
|
||||
curl -L "$URL" -o "$ZIP"
|
||||
unzip -p "$ZIP" "$REPO_NAME" > "$OUT"
|
||||
rm "$ZIP"
|
||||
|
||||
chmod +x "$OUT"
|
||||
|
||||
- name: Download game
|
||||
run: |
|
||||
TEMP="temp"
|
||||
|
||||
DEPOT_DOWNLOADER="$TEMP/DepotDownloader"
|
||||
GAME="$TEMP/game"
|
||||
|
||||
$DEPOT_DOWNLOADER -os $STEAM_OS -app $STEAM_APP -username $STEAM_USERNAME -password $STEAM_PASSWORD -dir $GAME -max-downloads 256
|
||||
- name: Download Client
|
||||
run: bun run download-client
|
||||
|
||||
- name: Build
|
||||
run: bun run --bun build
|
||||
|
||||
+2
-1
@@ -8,7 +8,8 @@
|
||||
"build": "cd packages/website && bun run build",
|
||||
"discover-ids": "cd packages/scripts && bun run discover-ids",
|
||||
"build-protos": "cd packages/scripts && bun run build-protos",
|
||||
"record-performance": "cd packages/scripts && bun run record-performance"
|
||||
"record-performance": "cd packages/scripts && bun run record-performance",
|
||||
"download-client": "cd packages/scripts && bun run download-client"
|
||||
},
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"scripts": {
|
||||
"discover-ids": "bun src/discoverIds/index.ts",
|
||||
"build-protos": "bun src/protos.ts",
|
||||
"record-performance": "bun src/recordPerformance/index.ts"
|
||||
"record-performance": "bun src/recordPerformance/index.ts",
|
||||
"download-client": "bun src/downloadClient/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzkit/closed": "workspace:*",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// dava engine has a lot of tiny files, this is faster
|
||||
export const DEPOT_DOWNLOADER_MAX_DOWNLOADS = 256;
|
||||
export const DEPOT_DOWNLOADER_OUTPUT = "../../temp/depotdownloader";
|
||||
export const DEPOT_DOWNLOADER_EXECUTABLE = `${DEPOT_DOWNLOADER_OUTPUT}/DepotDownloader`;
|
||||
@@ -0,0 +1,50 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import { $ } from "bun";
|
||||
import { rm } from "node:fs/promises";
|
||||
import {
|
||||
DEPOT_DOWNLOADER_EXECUTABLE,
|
||||
DEPOT_DOWNLOADER_MAX_DOWNLOADS,
|
||||
DEPOT_DOWNLOADER_OUTPUT,
|
||||
} from "./constants";
|
||||
import { QuickGitHubRelease } from "./types";
|
||||
|
||||
const provider = assertSecret(import.meta.env.CLIENT_PROVIDER);
|
||||
const source = assertSecret(import.meta.env.CLIENT_SOURCE);
|
||||
const dir = assertSecret(import.meta.env.CLIENT_DIR);
|
||||
|
||||
if (provider === "steam") {
|
||||
const [id, platform] = source.split("/");
|
||||
|
||||
console.log("Downloading Depot Downloader...");
|
||||
|
||||
const releases = await fetch(
|
||||
"https://api.github.com/repos/SteamRE/DepotDownloader/releases/latest",
|
||||
).then((response) => response.json() as Promise<QuickGitHubRelease>);
|
||||
const asset = releases.assets.find((asset) =>
|
||||
asset.name.includes("linux-x64"),
|
||||
);
|
||||
|
||||
if (!asset) {
|
||||
throw new Error("No linux-x64 asset found for Steam DepotDownloader");
|
||||
}
|
||||
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
await rm(DEPOT_DOWNLOADER_OUTPUT, { recursive: true, force: true });
|
||||
|
||||
await $`curl -L "${asset.browser_download_url}" -o "${DEPOT_DOWNLOADER_OUTPUT}.zip"`;
|
||||
await $`unzip "${DEPOT_DOWNLOADER_OUTPUT}.zip" -d "${DEPOT_DOWNLOADER_OUTPUT}"`;
|
||||
await $`chmod +x "${DEPOT_DOWNLOADER_EXECUTABLE}"`;
|
||||
|
||||
console.log("Downloading client...");
|
||||
|
||||
const username = assertSecret(import.meta.env.STEAM_USERNAME);
|
||||
const password = assertSecret(import.meta.env.STEAM_PASSWORD);
|
||||
|
||||
await $`${DEPOT_DOWNLOADER_EXECUTABLE} -os ${
|
||||
platform
|
||||
} -app ${id} -username ${username} -password ${
|
||||
password
|
||||
} -dir ${dir} -max-downloads ${DEPOT_DOWNLOADER_MAX_DOWNLOADS}`;
|
||||
} else {
|
||||
throw new Error(`Unknown provider: ${provider}`);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export interface QuickGitHubRelease {
|
||||
assets: Asset[];
|
||||
}
|
||||
|
||||
interface Asset {
|
||||
name: string;
|
||||
browser_download_url: string;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local";
|
||||
|
||||
export const vfs = new LocalVFS(assertSecret(import.meta.env.GAME_DIR));
|
||||
export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
|
||||
Reference in new issue
Block a user