2021-04-10 18:42:42 +02:00
|
|
|
name: Push @workadventure/iframe-api-typings to NPM
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [created]
|
2021-06-30 10:15:55 +02:00
|
|
|
push:
|
2021-04-10 18:42:42 +02:00
|
|
|
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'
|
2021-04-11 11:15:59 +02:00
|
|
|
|
|
|
|
- name: Replace version number
|
|
|
|
run: 'sed -i "s#VERSION_PLACEHOLDER#${GITHUB_REF/refs\/tags\//}#g" package.json'
|
|
|
|
working-directory: "front/packages/iframe-api-typings"
|
|
|
|
|
|
|
|
- name: Debug package.json
|
|
|
|
run: cat package.json
|
|
|
|
working-directory: "front/packages/iframe-api-typings"
|
|
|
|
|
2021-04-10 18:42:42 +02:00
|
|
|
- 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"
|
2021-06-29 18:39:43 +02:00
|
|
|
run: yarn run build-typings
|
2021-04-10 18:42:42 +02:00
|
|
|
env:
|
2021-06-29 18:39:43 +02:00
|
|
|
PUSHER_URL: "//localhost:8080"
|
2021-08-02 22:06:24 +02:00
|
|
|
ADMIN_URL: "//localhost:80"
|
2021-04-10 18:42:42 +02:00
|
|
|
working-directory: "front"
|
2021-04-10 19:14:36 +02:00
|
|
|
|
2021-04-10 18:42:42 +02:00
|
|
|
# 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
|
2021-04-10 19:14:36 +02:00
|
|
|
|
2021-06-30 10:15:55 +02:00
|
|
|
- name: Copy typings to package dir (2)
|
|
|
|
run: cp -R front/dist/src/Api front/packages/iframe-api-typings/Api
|
|
|
|
|
2021-04-10 18:42:42 +02:00
|
|
|
- name: Install dependencies in package
|
|
|
|
run: yarn install
|
|
|
|
working-directory: "front/packages/iframe-api-typings"
|
2021-04-10 19:14:36 +02:00
|
|
|
|
2021-04-10 18:42:42 +02:00
|
|
|
- name: Publish package
|
|
|
|
run: yarn publish
|
|
|
|
working-directory: "front/packages/iframe-api-typings"
|
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2021-06-30 10:15:55 +02:00
|
|
|
if: ${{ github.event_name == 'release' }}
|