Skip to content

Commit

Permalink
Merge pull request #130 from dolittle/7.4.1-elrond
Browse files Browse the repository at this point in the history
Contracts for gRPC Web
  • Loading branch information
jakhog authored Oct 26, 2022
2 parents 1b3d461 + 8cd110c commit b4a4b7d
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 2 deletions.
65 changes: 63 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Contracts CI/CD

env:
PRERELEASE_BRANCHES: treebeard
PRERELEASE_BRANCHES: treebeard,elrond

on:
push:
Expand Down Expand Up @@ -77,6 +77,29 @@ jobs:
working-directory: ./Generation/JavaScript
run: yarn build

java-script-web-build:
name: JavaScript.Web Build
runs-on: ubuntu-latest
needs: context
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript.Web
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript.Web/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript.Web
run: yarn build

golang-build:
name: Go Build
runs-on: ubuntu-latest
Expand All @@ -103,7 +126,7 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
needs: [context, dot-net-build, java-script-build, golang-build]
needs: [context, dot-net-build, java-script-build, java-script-web-build, golang-build]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -186,6 +209,44 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

java-script-web-release:
name: JavaScript.Web Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: ./Generation/JavaScript.Web
run: yarn
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ needs.context.outputs.versioninfo-version }}
files-to-update: |
Generation/JavaScript.Web/VersionInfo.js
- name: Build Contracts
working-directory: ./Generation/JavaScript.Web
run: yarn build
- name: Update Contracts version
working-directory: ./Generation/JavaScript.Web
run: npm version ${{ needs.context.outputs.version }}
- name: Extract tag from version
uses: actions-ecosystem/action-regex-match@v2
id: tag_regex
with:
text: ${{ needs.context.outputs.version }}
regex: '^\d+\.\d+.\d+-([^.]+)\.\d+$'
- name: Publish Contracts
working-directory: ./Generation/JavaScript.Web
run: npm publish --tag ${{ needs.context.outputs.release-type == 'prerelease' && steps.tag_regex.outputs.group1 || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

golang-release:
name: Go Release
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ Generation/JavaScript/**/*.d.ts
!Generation/JavaScript/VersionInfo.d.ts
!Generation/JavaScript/VersionInfo.js

# JavaScript.Web
Generation/JavaScript.Web/**/*.js
Generation/JavaScript.Web/**/*.d.ts
!Generation/JavaScript.Web/package.json
!Generation/JavaScript.Web/VersionInfo.d.ts
!Generation/JavaScript.Web/VersionInfo.js

# Go
Generation/Go/*
!Generation/Go/generate.sh
Expand Down
14 changes: 14 additions & 0 deletions Generation/JavaScript.Web/VersionInfo.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { Version } from './Versioning/Version_pb';

/**
* Provides information about the current version of the Contracts.
*/
export class VersionInfo {
/**
* Gets the current {@link Version} of the Contracts.
*/
static getCurrentVersion(): Version;
}
20 changes: 20 additions & 0 deletions Generation/JavaScript.Web/VersionInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

var Fundamentals_Versioning_Version_pb = require('./Versioning/Version_pb');

function VersionInfo() {}

VersionInfo.prototype.getCurrentVersion = function() {
return VersionInfo.getCurrentVersion();
}

VersionInfo.getCurrentVersion = function() {
return new Fundamentals_Versioning_Version_pb.Version()
.setMajor(377)
.setMinor(389)
.setPatch(368)
.setPrereleasestring('PRERELEASE');
}

exports.VersionInfo = VersionInfo;
38 changes: 38 additions & 0 deletions Generation/JavaScript.Web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@dolittle/contracts.web",
"description": "Grpc-Web contracts for Dolittle Fundamentals",
"version": "0.0.0",
"homepage": "https://dolittle.io",
"author": "Dolittle",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/dolittle-runtime/contracts.git"
},
"bugs": {
"url": "https://github.com/dolittle/home/issues"
},
"keywords": [
"dolittle",
"grpc"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"protofiles": "find ../../Source -name '*.proto'",
"generate": "grpc_tools_node_protoc --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:. --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` -I../../Source $(yarn -s protofiles)",
"keep_only_management_services": "find . -name '*_grpc_web_pb.*' -and -not -path './Runtime/Management/*' -delete",
"build": "yarn generate && yarn keep_only_management_services",
"prepublish": "yarn build"
},
"dependencies": {
"@types/google-protobuf": "3.15.5",
"grpc-web": "1.4.1",
"google-protobuf": "3.19.4"
},
"devDependencies": {
"grpc-tools": "1.11.2",
"protoc-gen-grpc-web": "1.4.0"
}
}

0 comments on commit b4a4b7d

Please sign in to comment.