diff --git a/.github/actions/cache-dotnet/action.yml b/.github/actions/cache-dotnet/action.yml index ca46ef37db..47f5fe58e9 100644 --- a/.github/actions/cache-dotnet/action.yml +++ b/.github/actions/cache-dotnet/action.yml @@ -3,11 +3,39 @@ description: Cache NuGet packages using Gitea Actions cache server runs: using: composite steps: + - name: Probe cache server + id: probe-cache + shell: bash + run: | + set -euo pipefail + url="${ACTIONS_CACHE_URL:-}" + if [ -z "$url" ]; then + echo "CACHE_AVAILABLE=false" >> "$GITHUB_ENV" + echo "No ACTIONS_CACHE_URL set; skipping cache." + exit 0 + fi + python - <<'PY' +import os, socket, sys, urllib.parse +url = os.environ.get("ACTIONS_CACHE_URL", "") +parsed = urllib.parse.urlparse(url) +host, port = parsed.hostname, parsed.port or (443 if parsed.scheme == "https" else 80) +ok = False +try: + with socket.create_connection((host, port), timeout=2): + ok = True +except OSError: + ok = False +print(f"probe {host}:{port} ok={ok}") +with open(os.environ["GITHUB_ENV"], "a") as f: + f.write(f"CACHE_AVAILABLE={'true' if ok else 'false'}\n") +PY + - name: Cache NuGet packages - uses: actions/cache@v3 + uses: actions/cache@v4 + if: env.CACHE_AVAILABLE == 'true' with: path: | ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-nuget- \ No newline at end of file + ${{ runner.os }}-nuget- diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9bc20cd361..a11f955a55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -122,6 +122,7 @@ PY PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} GITHUB_REPOSITORY: wylab/wylab-station-14 FORK_ID: wylab + ROBUST_CDN_URL: https://cdn.wylab.me/ if: ${{ steps.cdn-check.outputs.skip != 'true' }} - name: Trigger Docker image rebuild @@ -138,8 +139,8 @@ PY curl -sSL -X POST \ -H "Authorization: token ${DISPATCH_TOKEN}" \ -H "Content-Type: application/json" \ - https://git.wylab.me/api/v1/repos/${TARGET_REPO}/dispatches \ - -d "{\"event_type\":\"ss14-package-ready\",\"client_payload\":{\"commit\":\"${PAYLOAD}\"}}" + https://git.wylab.me/api/v1/repos/${TARGET_REPO}/actions/workflows/main.yml/dispatches \ + -d "{\"ref\":\"main\",\"inputs\":{\"commit\":\"${PAYLOAD}\"}}" # - name: Publish changelog (Discord) # continue-on-error: true diff --git a/Tools/publish_multi_request.py b/Tools/publish_multi_request.py index 11ceb29ded..6604b2941e 100755 --- a/Tools/publish_multi_request.py +++ b/Tools/publish_multi_request.py @@ -16,7 +16,7 @@ RELEASE_DIR = "release" # CONFIGURATION PARAMETERS # Forks should change these to publish to their own infrastructure. # -ROBUST_CDN_URL = "https://cdn.wylab.me/" +ROBUST_CDN_URL = os.environ.get("ROBUST_CDN_URL", "https://cdn.wylab.me/") def main(): parser = argparse.ArgumentParser()