Try fix workflow
Some checks failed
Generate and Release Protos / release (push) Failing after 23s

This commit is contained in:
2026-01-07 18:25:43 +00:00
parent ac3124ff14
commit 20cb7b101c

View File

@@ -38,29 +38,39 @@ jobs:
- name: Build and Publish TS - name: Build and Publish TS
working-directory: gen/ts working-directory: gen/ts
run: | run: |
# 1. Initialize with defaults
npm init -y npm init -y
# 1. Create the Namespaced index.ts from the FLAT files # 2. Build index.ts carefully
# This turns 'rail_backend_v1_pis_mapping.ts' into 'RailBackendV1PisMapping' # We ensure a space before 'from' and explicit double quotes around the path
echo "// Auto-generated" > index.ts
find . -maxdepth 1 -name "*.ts" -not -name "index.ts" | sed 's|^\./||; s|\.ts$||' | awk '{ find . -maxdepth 1 -name "*.ts" -not -name "index.ts" | sed 's|^\./||; s|\.ts$||' | awk '{
split($0, parts, "_"); # Create Namespace: split by underscore, capitalize each part
namespace=""; n = split($0, parts, "_");
for (i in parts) { name = "";
namespace = namespace toupper(substr(parts[i],1,1)) substr(parts[i],2); for (i=1; i<=n; i++) {
name = name toupper(substr(parts[i],1,1)) substr(parts[i],2);
} }
printf "export * as %s from \"./%s.js\";\n", namespace, $0 # CRITICAL: Space before from, escaped quotes around path
}' > index.ts printf "export * as %s from \"./%s.js\";\n", name, $0
}' >> index.ts
# 2. Update package.json # 3. Debug: Print index.ts so we can see it in logs if it fails again
cat index.ts
# 4. Update package.json using a robust jq call
# We use --arg to ensure the VERSION string doesn't break the JSON
VERSION="${{ steps.get_version.outputs.VERSION }}" VERSION="${{ steps.get_version.outputs.VERSION }}"
jq --arg ver "$VERSION" '.name = "@owlboard/backend-data-contracts" | jq --arg ver "$VERSION" \
.version = $ver | .type = "module" | .main = "./dist/index.js" | .types = "./dist/index.d.ts"' \ --arg name "@owlboard/backend-data-contracts" \
package.json > temp.json && mv temp.json package.json '.name = $name | .version = $ver | .type = "module" | .main = "./dist/index.js" | .types = "./dist/index.d.ts"' \
package.json > package.json.tmp && mv package.json.tmp package.json
# 3. Compile (No tsconfig needed with these flags) # 5. Compile with explicit flags
# We use 'nodenext' because it matches the .js extensions in our index.ts
npx tsc index.ts --declaration --module nodenext --target es2022 --moduleResolution nodenext --outDir dist/ --skipLibCheck true npx tsc index.ts --declaration --module nodenext --target es2022 --moduleResolution nodenext --outDir dist/ --skipLibCheck true
# 4. Publish # 6. Authenticate and Publish
npm config set //git.fjla.uk/api/packages/owlboard/npm/:_authToken ${{ secrets.PACKAGE_PUSH }} npm config set //git.fjla.uk/api/packages/owlboard/npm/:_authToken ${{ secrets.PACKAGE_PUSH }}
npm publish npm publish