Skip to content

Commit

Permalink
build: setup project to build client
Browse files Browse the repository at this point in the history
  • Loading branch information
edalex-ian committed Jun 18, 2021
0 parents commit 36e3d65
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Kaltura Typescript Client build

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Build
run: ./build-kaltura-client.sh

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: kaltura-typescript-client-*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.17.0
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Kaltura Typescript Client (Build Repo)

This is simply a repo to provide a publicly accessibly version of
https://github.com/kaltura/KalturaGeneratedAPIClientsTypescript. From time to time it will build a
required version of that client, and then 'publish' it as a 'release' on this repo. Not being the
owner of the code, we do not publish it to NPM etc. But at least by using GitHub releases we can
then have a HTTP URL we can use within other `package.json` dependency blocks.

## Rationale

For unknown reasons Kaltura do not publish this to NPM, however that makes it rather difficult for
usage - especially if you want to do it in a module then used for a larger app (such as the Kaltura
Simple Uploader module). So this simplifies these issues.

## Usage

Simply go to the release of interest, and then copy the resultant URL for the `tgz` of the build and
use it in your `package.json`.
23 changes: 23 additions & 0 deletions build-kaltura-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

## Change these as required
GITHUB_VER=17.2.0
CLIENT_VER=7.0.2

## Below will hopefully rarely need changing
PROJECT_DIR=$(pwd)
CLIENT_BUILD_DIR=kaltura-typescript-client
DIST_FILE_PREFIX=kaltura-typescript-client-$CLIENT_VER

# Make sure we start clean
rm -rf $CLIENT_BUILD_DIR

# Download, build and NPM install
wget -O - https://github.com/kaltura/KalturaGeneratedAPIClientsTypescript/archive/v${GITHUB_VER}.tar.gz | \
tar --transform="s/KalturaGeneratedAPIClientsTypescript-${GITHUB_VER}/${CLIENT_BUILD_DIR}/" -zxv && \
cd $CLIENT_BUILD_DIR && \
npm install && \
npm run deploy && \
mv dist/$DIST_FILE_PREFIX*.tgz "$PROJECT_DIR" && \
cd "$PROJECT_DIR" || \
(echo "Failed to build Kaltura Typescript Client, aborting..."; exit 1;)

0 comments on commit 36e3d65

Please sign in to comment.