From 6b8201c47d8d6ecf248a22c647d4b7ca49310593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B8genes?= <1014990+jakhog@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:39:28 +0200 Subject: [PATCH 1/5] Create prerelease branch for Grpc.Web --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 665a9fe..8daa09f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: Contracts CI/CD env: - PRERELEASE_BRANCHES: treebeard + PRERELEASE_BRANCHES: treebeard,elrond on: push: From 9080b20c5ef03abfabab24fe79ad1d059f4c43a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B8genes?= <1014990+jakhog@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:40:35 +0200 Subject: [PATCH 2/5] Code generation for grpc-web for Management --- .gitignore | 7 ++++ Generation/JavaScript.Web/VersionInfo.d.ts | 14 ++++++++ Generation/JavaScript.Web/VersionInfo.js | 20 ++++++++++++ Generation/JavaScript.Web/package.json | 38 ++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 Generation/JavaScript.Web/VersionInfo.d.ts create mode 100644 Generation/JavaScript.Web/VersionInfo.js create mode 100644 Generation/JavaScript.Web/package.json diff --git a/.gitignore b/.gitignore index 1984312..3570b53 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Generation/JavaScript.Web/VersionInfo.d.ts b/Generation/JavaScript.Web/VersionInfo.d.ts new file mode 100644 index 0000000..4302e7a --- /dev/null +++ b/Generation/JavaScript.Web/VersionInfo.d.ts @@ -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; +} \ No newline at end of file diff --git a/Generation/JavaScript.Web/VersionInfo.js b/Generation/JavaScript.Web/VersionInfo.js new file mode 100644 index 0000000..8e4dc68 --- /dev/null +++ b/Generation/JavaScript.Web/VersionInfo.js @@ -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; diff --git a/Generation/JavaScript.Web/package.json b/Generation/JavaScript.Web/package.json new file mode 100644 index 0000000..7e24dfa --- /dev/null +++ b/Generation/JavaScript.Web/package.json @@ -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" + } +} From 13cea922fdac030380ee52c847a6664d1598ddf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B8genes?= <1014990+jakhog@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:44:10 +0200 Subject: [PATCH 3/5] CI workflows for JavaScript.Web --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8daa09f..1fa2f95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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.Web/JavaScript + run: yarn build + golang-build: name: Go Build runs-on: ubuntu-latest @@ -186,6 +209,46 @@ 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 From e7a853c81c0ffef69dc479c2aae510c74eb5c87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B8genes?= <1014990+jakhog@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:46:37 +0200 Subject: [PATCH 4/5] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fa2f95..1ffbcff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: files-to-update: | Generation/JavaScript.Web/VersionInfo.js - name: Build Contracts - working-directory: ./Generation.Web/JavaScript + working-directory: ./Generation/JavaScript.Web run: yarn build golang-build: From 1e876f138cb70982ce6df804f5cab7e3bba2f950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20H=C3=B8genes?= <1014990+jakhog@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:48:45 +0200 Subject: [PATCH 5/5] Missing CI dependency --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ffbcff..450a17a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,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 @@ -209,8 +209,6 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - java-script-web-release: name: JavaScript.Web Release runs-on: ubuntu-latest