Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af3c82518c | |||
| 9511db8ee9 | |||
| fc92331238 | |||
| a4e6386fd1 |
@@ -78,16 +78,23 @@ jobs:
|
|||||||
ZIP_ROOT="/tmp/go_upload"
|
ZIP_ROOT="/tmp/go_upload"
|
||||||
FULL_PATH="$ZIP_ROOT/$MOD_NAME@$VERSION"
|
FULL_PATH="$ZIP_ROOT/$MOD_NAME@$VERSION"
|
||||||
|
|
||||||
|
# 1. Prepare
|
||||||
cd gen/go
|
cd gen/go
|
||||||
go mod init $MOD_NAME
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
|
# 2. Initialize the module
|
||||||
|
go mod init "$MOD_NAME"
|
||||||
|
|
||||||
|
# 3. Create the structure
|
||||||
mkdir -p "$FULL_PATH"
|
mkdir -p "$FULL_PATH"
|
||||||
cp -r . "$FULL_PATH/"
|
|
||||||
|
|
||||||
pushd "$ZIP_ROOT"
|
# 4. Copy the CONTENTS of models to the root of the module
|
||||||
zip -r "$GITHUB_WORKSPACE/module.zip" .
|
# This flattens the structure so the .go files are next to go.mod
|
||||||
popd
|
cp -r models/* "$FULL_PATH/"
|
||||||
|
cp go.mod "$FULL_PATH/"
|
||||||
|
|
||||||
|
# 5. Zip and Upload
|
||||||
|
cd "$ZIP_ROOT"
|
||||||
|
zip -r -D "$GITHUB_WORKSPACE/module.zip" .
|
||||||
|
|
||||||
curl -f --user "owlbot:${{ secrets.PACKAGE_PUSH }}" \
|
curl -f --user "owlbot:${{ secrets.PACKAGE_PUSH }}" \
|
||||||
--upload-file "$GITHUB_WORKSPACE/module.zip" \
|
--upload-file "$GITHUB_WORKSPACE/module.zip" \
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ for file in $FILES; do
|
|||||||
npx --yes json-schema-to-typescript "$file" > "gen/ts/${clean_name}.ts"
|
npx --yes json-schema-to-typescript "$file" > "gen/ts/${clean_name}.ts"
|
||||||
|
|
||||||
# Generate Go
|
# Generate Go
|
||||||
go-jsonschema -p models "$file" > "gen/go/models/${clean_name}.go"
|
go-jsonschema -p contracts "$file" > "gen/go/models/${clean_name}.go"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "✅ Generated single TS package in gen/ts"
|
echo "✅ Generated single TS package in gen/ts"
|
||||||
|
|||||||
Reference in New Issue
Block a user