forked from wylab/wylab-station-14
Cache NuGet and RobustToolbox outputs
This commit is contained in:
@@ -14,6 +14,8 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CDN_MANIFEST_URL: https://cdn.wylab.me/fork/wylab/manifest
|
||||
steps:
|
||||
- name: Fail if we are attempting to run on the master branch
|
||||
if: ${{GITHUB.REF_NAME == 'master' && github.repository == 'space-wizards/space-station-14'}}
|
||||
@@ -26,6 +28,41 @@ jobs:
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Check if build already published
|
||||
id: cdn-check
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - <<'PY'
|
||||
import json, os, urllib.request, sys
|
||||
url = os.environ["CDN_MANIFEST_URL"]
|
||||
sha = os.environ["GITHUB_SHA"].lower()
|
||||
with urllib.request.urlopen(url) as resp:
|
||||
manifest = json.load(resp)
|
||||
exists = sha in manifest.get("builds", {})
|
||||
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
|
||||
f.write(f"skip={'true' if exists else 'false'}\n")
|
||||
if exists:
|
||||
print(f"Build {sha} already present on CDN; skipping packaging.")
|
||||
else:
|
||||
print(f"Build {sha} not found on CDN; continuing.")
|
||||
PY
|
||||
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'global.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
- name: Cache RobustToolbox build output
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: RobustToolbox/bin
|
||||
key: ${{ runner.os }}-robust-${{ hashFiles('RobustToolbox/**/*.csproj', 'global.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-robust-
|
||||
|
||||
# Corvax-Secrets-Start
|
||||
- name: Setup secrets
|
||||
env:
|
||||
@@ -51,23 +88,29 @@ jobs:
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Get Engine Tag
|
||||
run: |
|
||||
cd RobustToolbox
|
||||
git fetch --depth=1
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Build Packaging
|
||||
run: dotnet build Content.Packaging --configuration Release --no-restore /m
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Package server
|
||||
run: dotnet run --project Content.Packaging server --platform win-x64 --platform win-arm64 --platform linux-x64 --platform linux-arm64 --platform osx-x64 --platform osx-arm64
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Package client
|
||||
run: dotnet run --project Content.Packaging client --no-wipe-release
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Publish version
|
||||
run: Tools/publish_multi_request.py
|
||||
@@ -75,9 +118,10 @@ jobs:
|
||||
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||
GITHUB_REPOSITORY: wylab/wylab-station-14
|
||||
FORK_ID: wylab
|
||||
if: ${{ steps.cdn-check.outputs.skip != 'true' }}
|
||||
|
||||
- name: Trigger Docker image rebuild
|
||||
if: ${{ success() }}
|
||||
if: ${{ success() && steps.cdn-check.outputs.skip != 'true' }}
|
||||
env:
|
||||
DISPATCH_TOKEN: ${{ secrets.DOCKER_TRIGGER_TOKEN }}
|
||||
TARGET_REPO: wylab/WS14-Docker-Linux-Server
|
||||
|
||||
Reference in New Issue
Block a user