Files
blitzkit/.github/workflows/website.yml
T
2025-04-01 21:12:39 -05:00

132 lines
3.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 }}
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 --verbosepa &
SERVER_PID=$!
cd ../..
bun run build:website
kill $SERVER_PID || true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
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