fix: run catalog checks outside Unity containers
This commit is contained in:
@@ -4,7 +4,27 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
catalog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Validate submodules and version catalog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
ref="${{ gitea.sha }}"
|
||||||
|
git init .
|
||||||
|
git remote add origin "https://git.crash.work/ShrinkSDK/Workspace.git"
|
||||||
|
git fetch --depth=1 origin "$ref"
|
||||||
|
git checkout --detach FETCH_HEAD
|
||||||
|
git submodule sync --recursive
|
||||||
|
git submodule update --init --recursive
|
||||||
|
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
||||||
|
node Tools/Release/update-shrinksdk-versions.mjs --check
|
||||||
|
|
||||||
editmode:
|
editmode:
|
||||||
|
needs: catalog
|
||||||
runs-on: unity-2022.3.62f3
|
runs-on: unity-2022.3.62f3
|
||||||
container:
|
container:
|
||||||
image: docker.1panel.live/unityci/editor:ubuntu-2022.3.62f3-windows-mono-3
|
image: docker.1panel.live/unityci/editor:ubuntu-2022.3.62f3-windows-mono-3
|
||||||
@@ -28,7 +48,6 @@ jobs:
|
|||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
||||||
node Tools/Release/update-shrinksdk-versions.mjs --check
|
|
||||||
|
|
||||||
- name: Run every standalone package EditMode host
|
- name: Run every standalone package EditMode host
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -7,7 +7,27 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
catalog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Validate submodules and version catalog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
ref="${{ gitea.sha }}"
|
||||||
|
git init .
|
||||||
|
git remote add origin "https://git.crash.work/ShrinkSDK/Workspace.git"
|
||||||
|
git fetch --depth=1 origin "$ref"
|
||||||
|
git checkout --detach FETCH_HEAD
|
||||||
|
git submodule sync --recursive
|
||||||
|
git submodule update --init --recursive
|
||||||
|
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
||||||
|
node Tools/Release/update-shrinksdk-versions.mjs --check
|
||||||
|
|
||||||
unity:
|
unity:
|
||||||
|
needs: catalog
|
||||||
runs-on: unity-2022.3.62f3
|
runs-on: unity-2022.3.62f3
|
||||||
container:
|
container:
|
||||||
image: docker.1panel.live/unityci/editor:ubuntu-2022.3.62f3-windows-mono-3
|
image: docker.1panel.live/unityci/editor:ubuntu-2022.3.62f3-windows-mono-3
|
||||||
@@ -31,7 +51,6 @@ jobs:
|
|||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
bash Tools/CI/Validate-Submodules.sh "$PWD"
|
||||||
node Tools/Release/update-shrinksdk-versions.mjs --check
|
|
||||||
|
|
||||||
- name: Compile Workspace and validate package graph
|
- name: Compile Workspace and validate package graph
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -25,20 +25,41 @@ fi
|
|||||||
published_value() {
|
published_value() {
|
||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
local property_name="$2"
|
local property_name="$2"
|
||||||
node --input-type=module - "$published_catalog" "$package_name" "$property_name" <<'NODE'
|
local value
|
||||||
import { readFileSync } from 'node:fs';
|
value="$(awk -v package_name="$package_name" -v property_name="$property_name" '
|
||||||
|
index($0, "\"" package_name "\"") {
|
||||||
|
in_package = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
in_package && index($0, "\"" property_name "\"") {
|
||||||
|
value = $0
|
||||||
|
sub(/^[^:]*:[[:space:]]*"/, "", value)
|
||||||
|
sub(/".*$/, "", value)
|
||||||
|
print value
|
||||||
|
found = 1
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
in_package && /^[[:space:]]*}/ {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (!found) exit 1
|
||||||
|
}
|
||||||
|
' "$published_catalog")" || {
|
||||||
|
echo "Published catalog value is missing: ${package_name}.${property_name}" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
const [, , catalogPath, packageName, propertyName] = process.argv;
|
if [[ -z "$value" ]]; then
|
||||||
const catalog = JSON.parse(readFileSync(catalogPath, 'utf8'));
|
echo "Published catalog value is empty: ${package_name}.${property_name}" >&2
|
||||||
const value = catalog.packages?.[packageName]?.[propertyName];
|
return 1
|
||||||
if (typeof value !== 'string' || value.length === 0) {
|
fi
|
||||||
throw new Error(`Published catalog value is missing: ${packageName}.${propertyName}`);
|
if [[ "$property_name" == "version" && ! "$value" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||||
}
|
echo "Published catalog version is invalid: ${package_name}=${value}" >&2
|
||||||
if (propertyName === 'version' && !/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(value)) {
|
return 1
|
||||||
throw new Error(`Published catalog version is invalid: ${packageName}=${value}`);
|
fi
|
||||||
}
|
|
||||||
process.stdout.write(value);
|
printf '%s' "$value"
|
||||||
NODE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export SHRINKSDK_PUBLISHED_STARTER_VERSION="$(published_value com.cneicy.shrink-app-starter-basic version)"
|
export SHRINKSDK_PUBLISHED_STARTER_VERSION="$(published_value com.cneicy.shrink-app-starter-basic version)"
|
||||||
|
|||||||
Reference in New Issue
Block a user