6acf0ff047
If users are willing to use Typescript to develop scripts for maps, they will need typings for the `WA` object. This commit creates a new package (@workadventure/iframe-api-typings) that contains only the `iframe_api.d.ts` file. The file is generated from the build of the front and isolated in this package. This is necessary because the iframe_api.js file is supposed to always be loaded from WorkAdventure directly (and there is no @workadventure/iframe-api package and there will never be one)
56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Push @workadventure/iframe-api-typings to NPM
|
|
on:
|
|
# TODO remove action on push
|
|
push: ~
|
|
release:
|
|
types: [created]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
# Setup .npmrc file to publish to npm
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '14.x'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
# TODO: replace version with RELEASE tag
|
|
# TODO: enable declaration flag in tsconfig dynamically
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v1
|
|
with:
|
|
version: '3.x'
|
|
|
|
- name: "Install dependencies"
|
|
run: yarn install
|
|
working-directory: "front"
|
|
|
|
- name: "Install messages dependencies"
|
|
run: yarn install
|
|
working-directory: "messages"
|
|
|
|
- name: "Build proto messages"
|
|
run: yarn run proto && yarn run copy-to-front
|
|
working-directory: "messages"
|
|
|
|
- name: "Create index.html"
|
|
run: ./templater.sh
|
|
working-directory: "front"
|
|
|
|
- name: "Build"
|
|
run: yarn run build
|
|
env:
|
|
API_URL: "localhost:8080"
|
|
working-directory: "front"
|
|
# We build the front to generate the typings of iframe_api, then we copy those typings in a separate package.
|
|
- name: Copy typings to package dir
|
|
run: cp front/dist/src/iframe_api.d.ts front/packages/iframe-api-typings/iframe_api.d.ts
|
|
- name: Install dependencies in package
|
|
run: yarn install
|
|
working-directory: "front/packages/iframe-api-typings"
|
|
- name: Publish package
|
|
run: yarn publish
|
|
working-directory: "front/packages/iframe-api-typings"
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|