@@ -88,11 +88,50 @@ jobs:
8888 # Only clone the community submodule which is public and needed for the build
8989 git submodule update --init community
9090
91+ - name : Set up Node.js
92+ uses : actions/setup-node@v4
93+ with :
94+ node-version : " 20"
95+
9196 - id : get_tag
9297 run : |
9398 cat ./apps/api/karrio/server/VERSION
9499 echo "tag=$(cat ./apps/api/karrio/server/VERSION)" >> "$GITHUB_ENV"
95100
101+ - name : Build JS client
102+ run : |
103+ # Generate TypeScript fetch client from OpenAPI schema
104+ docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
105+ -i /local/schemas/openapi.yml \
106+ -g typescript-fetch \
107+ -o /local/packages/karriojs/api/generated \
108+ --additional-properties=typescriptThreePlus=true \
109+ --additional-properties=modelPropertyNaming=snake_case \
110+ --additional-properties=useSingleRequestParameter=true
111+
112+ # Build browser JS bundle
113+ cd packages/karriojs
114+ npm install
115+ npx gulp build --output "${GITHUB_WORKSPACE}/apps/api/karrio/server/static/karrio/js/karrio.js"
116+ cd -
117+
118+ - name : Build embeddable elements
119+ run : |
120+ cd packages/elements
121+ npm install
122+ npm run build
123+
124+ # Copy built elements to Django static directory
125+ ELEMENTS_STATIC="${GITHUB_WORKSPACE}/apps/api/karrio/server/static/karrio/elements"
126+ mkdir -p "${ELEMENTS_STATIC}" "${ELEMENTS_STATIC}/chunks"
127+ cp dist/elements.js dist/globals.css "${ELEMENTS_STATIC}/"
128+ cp dist/ratesheet.js dist/ratesheet.html "${ELEMENTS_STATIC}/"
129+ cp dist/devtools.js dist/devtools.css dist/devtools.html "${ELEMENTS_STATIC}/"
130+ cp dist/template-editor.js dist/template-editor.html "${ELEMENTS_STATIC}/"
131+ cp dist/connections.js dist/connections.html "${ELEMENTS_STATIC}/"
132+ [ -d dist/chunks ] && cp dist/chunks/* "${ELEMENTS_STATIC}/chunks/"
133+ cd -
134+
96135 - name : Build karrio server image
97136 run : |
98137 echo 'Building karrio server:${{ env.tag }}...'
0 commit comments