Fully disconnect on failure. #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET | |
on: | |
push: | |
paths: | |
- SteamUtils/** | |
- SchemaBuilder/** | |
- Config/** | |
- .github/workflows/dotnet.yml | |
workflow_dispatch: {} | |
schedule: | |
- cron: '0 0 * * 1,4' | |
jobs: | |
build: | |
runs-on: windows-2019 | |
permissions: | |
contents: read | |
id-token: write # For federated auth | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: 'true' | |
submodules: 'true' | |
- name: setup-msbuild | |
uses: microsoft/[email protected] | |
# Restore NuGet | |
- name: Setup NuGet.exe for use with actions | |
uses: NuGet/[email protected] | |
- name: Generate NuGet Cache Key | |
id: nuget_cache_key | |
run: powershell -Command echo "key=nuget-cache-$((Get-FileHash -InputStream ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes((Select-String -Path "*/*.csproj" -Pattern "PackageReference" | foreach {$_.line.Trim()} | Sort-Object))))).Hash)" >> $env:GITHUB_OUTPUT | |
- name: Cache Nuget | |
uses: actions/cache@v3 | |
with: | |
key: ${{ steps.nuget_cache_key.outputs.key }} | |
path: ~/.nuget/packages | |
- name: Restore dependencies | |
run: msbuild /p:Configuration=Release -t:restore SchemaGenerator.sln | |
# Compile | |
- name: Build | |
run: msbuild "/p:SolutionDir=$env:GITHUB_WORKSPACE" /p:Configuration=Release SchemaBuilder/SchemaBuilder.csproj | |
# Restore game cache keys. | |
- name: Generate game cache key | |
id: game_cache_key | |
run: powershell -Command echo "key=game-cache-v3-$(Get-Date -Format yyyy-MM)" >> $env:GITHUB_OUTPUT | |
- name: Cache Game Binaries | |
uses: actions/cache@v3 | |
with: | |
key: ${{ steps.game_cache_key.outputs.key }} | |
restore-keys: | | |
game-cache-v3- | |
path: game/ | |
# Build Schemas | |
- name: Generate vanilla SE schema | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe schema space-vanilla | |
- name: Generate vanilla ME schema | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe schema medieval-vanilla | |
- name: Generate modded ME schema | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe schema medieval-modded | |
# Upload Schemas | |
- name: Upload Schemas | |
uses: actions/upload-artifact@v4 | |
with: | |
name: schemas | |
path: schemas/ | |
# Build Data Files | |
- name: Generate vanilla SE data | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe data space-vanilla | |
- name: Generate vanilla ME data | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe data medieval-vanilla | |
- name: Generate industrial ME data | |
run: SchemaBuilder/bin/Release/SchemaBuilder.exe data medieval-industrial | |
# Upload Data | |
- name: Upload Data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data | |
path: data/ | |
# Publish to GCS | |
- name: Log into gcloud | |
id: auth | |
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && github.event_name != 'pull_request' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
workload_identity_provider: 'projects/445692247363/locations/global/workloadIdentityPools/github-actions/providers/github-actions' | |
service_account: '[email protected]' | |
- name: Release Schemas | |
uses: 'google-github-actions/upload-cloud-storage@v2' | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
with: | |
path: schemas/ | |
destination: "unofficial-keen-schemas/latest/" | |
parent: false | |
headers: |- | |
cache-control: public, max-age=300, must-revalidate |