Skip to content

feat: update schema files #65

feat: update schema files

feat: update schema files #65

Workflow file for this run

name: Build
on:
workflow_call:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
schema-matrix:
runs-on: ubuntu-22.04
outputs:
schema: ${{ steps.set-matrix.outputs.schema }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "::set-output name=schema::$(ls schema/ | jq -R -s -c 'split("\n")[:-1]' )"
build-ts:
runs-on: ubuntu-22.04
needs: schema-matrix
strategy:
matrix:
schema: ${{ fromJson(needs.schema-matrix.outputs.schema) }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup node environment (for building)
uses: actions/setup-node@v3
with:
node-version: 18.12.0
- name: Installing quicktype
run: |
yarn global add quicktype
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Prepare package path
id: package
run: |
SCHEMA=${{ matrix.schema }}
PACKAGE_SRC=$(echo "ts/${SCHEMA/okp4-/""}-schema")
mkdir ${PACKAGE_SRC}/gen-ts
echo "DESTINATION=$(echo "ts/${SCHEMA/okp4-/""}-schema")" >> $GITHUB_OUTPUT
- name: Generate sources
run: |
quicktype -s schema schema/${{ matrix.schema }}/*.json -o ${{ steps.package.outputs.DESTINATION }}/gen-ts/schema.ts --prefer-types --prefer-unions
- name: Fetch dependencies
run: yarn --cwd ${{ steps.package.outputs.DESTINATION }}
- name: Build
run: yarn --cwd ${{ steps.package.outputs.DESTINATION }} build