Merge pull request #8 from axone-protocol/dependabot/github_actions/c… #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
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/axone-/""}-schema") | |
mkdir ${PACKAGE_SRC}/gen-ts | |
echo "DESTINATION=$(echo "ts/${SCHEMA/axone-/""}-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 |