From 834abbfa03f6029a742d4e4e684d930de490219d Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 25 Jun 2025 14:31:58 +0530 Subject: [PATCH 01/22] Added workflow for build, run test cases and sonar analysis on a PR. Linting steps also added in the workflow. --- .eslintrc | 48 -------------- .eslintrc.js | 53 +++++++++++++++ .github/workflows/pull-request.yml | 101 +++++++++++++++++++++++++++++ package.json | 7 +- 4 files changed, 159 insertions(+), 50 deletions(-) delete mode 100644 .eslintrc create mode 100644 .eslintrc.js create mode 100644 .github/workflows/pull-request.yml diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 79a332a..0000000 --- a/.eslintrc +++ /dev/null @@ -1,48 +0,0 @@ -{ - "extends": "standard", - "globals": { - "org": true, - "CryptoJS": true, - "_": true, - "$": true, - "angular": true, - "ecEditor": true, - "EkTelemetry": true, - "EkstepEditor": true, - "EkstepEditorAPI": true, - "Class": true, - "UUID": true, - "WebFontConfig": true, - "TextWYSIWYG": true, - "ManifestGenerator": true, - "WebFont": true, - "fabric": true, - "ServiceConstants": true, - "async": true, - "Fingerprint2": true, - "describe": true, - "jasmine": true, - "afterAll": true, - "beforeAll": true, - "it": true, - "spyOn": true, - "expect": true, - "xit": true, - "EventBus": true, - "beforeEach": true, - "canvas": true, - "Plugin": true, - "createjs": true, - "p": true, - "basePlugin": true, - "Mousetrap": true, - "afterEach": true, - "location": true, - "X2JS": true - }, - "rules": { - "indent": [2, "tab"], - "no-tabs": 0, - "no-throw-literal": "error" - } -} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..c6e137b --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,53 @@ +// this plugin is used to make all rules default to warnings +equire('eslint-plugin-only-warn'); + +module.exports = { + extends: 'standard', + plugins: ['only-warn'], // makes all rules default to warnings + ignorePatterns: ['gulpfile.js', 'webpack.config.js', 'app/bower_components/**'], + globals: { + org: true, + CryptoJS: true, + _: true, + $: true, + angular: true, + ecEditor: true, + EkTelemetry: true, + EkstepEditor: true, + EkstepEditorAPI: true, + Class: true, + UUID: true, + WebFontConfig: true, + TextWYSIWYG: true, + ManifestGenerator: true, + WebFont: true, + fabric: true, + ServiceConstants: true, + async: true, + Fingerprint2: true, + describe: true, + jasmine: true, + afterAll: true, + beforeAll: true, + it: true, + spyOn: true, + expect: true, + xit: true, + EventBus: true, + beforeEach: true, + canvas: true, + Plugin: true, + createjs: true, + p: true, + basePlugin: true, + Mousetrap: true, + afterEach: true, + location: true, + X2JS: true + }, + rules: { + indent: [2, 'tab'], + 'no-tabs': 0, + 'no-throw-literal': 'error', + } +} \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..9ce5311 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,101 @@ +name: Build and Test on Pull Request + +on: + pull_request: + branches: + - '**' + +env: + CONTENT_PLUGIN_VERSION: ${{ vars.CONTENT_PLUGIN_VERSION || 'release-8.0.0' }} + +jobs: + build-test: + runs-on: ubuntu-latest + env: + version_number: ${{ github.ref_name }} + build_number: ${{ github.run_number }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js 10 + uses: actions/setup-node@v3 + with: + node-version: 10.24.1 + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} + + - name: Clone plugins (from fork) + run: | + git clone --branch ${{ env.CONTENT_PLUGIN_VERSION }} https://github.com/vinodbhorge/sunbird-content-plugins.git plugins + + - name: Install dependencies + run: | + which bower || sudo npm install -g bower@1.8.0 + which grunt || sudo npm install -g grunt-cli@1.2.0 + which gulp || sudo npm install -g gulp@3.9.1 + sudo apt-get install build-essential libpng-dev + + - name: Bower cache clean + working-directory: app + run: bower cache clean --allow-root + + - name: Bower install + working-directory: app + run: bower install --force --allow-root + + - name: Install global npm packages + run: npm install --legacy-peer-deps + + - name: Gulp packageCorePlugins + run: gulp packageCorePlugins + + - name: Plugin build + run: npm run plugin-build + + - name: Run build + run: npm run build + + - name: Test + run: npm run test + continue-on-error: true + + - name: Set up Node.js 14 (for Sonar) + uses: actions/setup-node@v3 + with: + node-version: 14 + + - name: Install SonarQube scanner + run: npm install -g sonarqube-scanner + + - name: Run SonarQube scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: sonar-scanner + + lint: + needs: build-test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} + + - name: Run Lint + run: npm run lint \ No newline at end of file diff --git a/package.json b/package.json index 0aa03b4..514fd4f 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,14 @@ "css-tree": "1.0.0-alpha.29", "csso": "3.5.1", "cssnano": "4.1.10", - "eslint": "^5.6.0", + "eslint": "^8.57.1", "global": "^4.4.0", "eslint-plugin-import": "^2.14.0", "eslint-plugin-node": "^7.0.1", "eslint-plugin-promise": "^4.0.1", "eslint-plugin-standard": "^4.0.0", + "eslint-config-standard": "^12.0.0", + "eslint-plugin-only-warn": "^1.0.4", "expose-loader": "^0.7.5", "express-http-proxy": "^1.2.0", "extract": "^1.0.0", @@ -105,7 +107,8 @@ "plugin-build": "webpack --config webpack.plugin.config.js", "build-editor": "npm run test && npm run collection-plugins && npm run build", "test": "karma start karmaconf.js", - "build-npm-pkg": "gulp packageCorePlugins && npm run plugin-build && webpack --env.channel=NPM_PACKAGE && cd generic-editor && gulp copystyleImages && gulp clean && gulp injectrenamedfiles" + "build-npm-pkg": "gulp packageCorePlugins && npm run plugin-build && webpack --env.channel=NPM_PACKAGE && cd generic-editor && gulp copystyleImages && gulp clean && gulp injectrenamedfiles", + "lint": "eslint . --quiet" }, "repository": { "type": "git", From dd57bfc7b347aa2e6678ab61488ce1a6797b01f6 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 25 Jun 2025 14:55:19 +0530 Subject: [PATCH 02/22] Updated the Readme file. --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index aabadd1..921c939 100644 --- a/README.md +++ b/README.md @@ -170,3 +170,27 @@ We use [SemVer](https://semver.org/) for versioning. For the versions available, ## Any Issues? We have an open and active [issue tracker](https://project-sunbird.atlassian.net/issues/). Please report any issues. + +# GitHub Actions + +## Build and Test on Pull Request + +This GitHub Actions workflow runs **build, test, and lint checks** automatically when a pull request is opened against any branch. + +### When It Runs + +- **Trigger**: On every `pull_request` to any branch (`'**'`) + +### Prerequisites Before Triggering + +Make sure the following are set up **before** opening a pull request: + +### Secrets +`SONAR_TOKEN`: For SonarQube authentication + +### Repository Variables +`CONTENT_PLUGIN_VERSION`: Have to specify the branch or tag you want fetch. By default it will take `release-8.0.0` + +Note: The secrets and variables should be set in Github UI (`settings/secrets and variables/actions`). + +For any changes to the workflow, update the file `.github/workflows/build-test.yml` accordingly. \ No newline at end of file From 4426d19fcda705db000f25415b0e218353cecbe7 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 25 Jun 2025 16:35:02 +0530 Subject: [PATCH 03/22] Added workflow to publish to npm. --- .github/workflows/publish.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d117212 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: Publish Sunbird-generic-editor to NPM + +on: + push: + branches: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + registry-url: 'https://registry.npmjs.org/' + + - name: Install global dependencies + run: | + npm install -g bower@1.8.0 grunt-cli@1.2.0 gulp@3.9.1 + + - name: Install dependencies + run: npm install --legacy-peer-deps + + - name: Install bower dependencies + working-directory: app + run: | + bower cache clean --allow-root + bower install --force --allow-root + + - name: Build NPM package + run: npm run build-npm-pkg + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file From c98005fbec0819c805432a7102cbfa6308229b66 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 25 Jun 2025 16:40:10 +0530 Subject: [PATCH 04/22] Added workflow to publish to npm. --- .github/workflows/publish.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d117212..04a1007 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22.x' + node-version: '14' registry-url: 'https://registry.npmjs.org/' - name: Install global dependencies @@ -25,6 +25,10 @@ jobs: - name: Install dependencies run: npm install --legacy-peer-deps + env: + PHANTOMJS_PLATFORM: linux + PHANTOMJS_ARCH: x64 + TMPDIR: /tmp - name: Install bower dependencies working-directory: app From 3be6c15737bb76aba91c71de49032fe391b0a462 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 25 Jun 2025 17:26:45 +0530 Subject: [PATCH 05/22] Updated the eslint.js file --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index c6e137b..9310e2c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,5 @@ // this plugin is used to make all rules default to warnings -equire('eslint-plugin-only-warn'); +require('eslint-plugin-only-warn'); module.exports = { extends: 'standard', From 0511207957f8fae2d9d8fa75ee51e510fb084ce1 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 05:15:23 +0530 Subject: [PATCH 06/22] updated the workflow --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 04a1007..ffe8f76 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish Sunbird-generic-editor to NPM +name: Publish Sunbird-generic-editor to blob on: push: @@ -13,12 +13,22 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '14' registry-url: 'https://registry.npmjs.org/' + - name: Clone content plugins + run: | + git clone https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins -b release-5.2.0 + - name: Install global dependencies run: | npm install -g bower@1.8.0 grunt-cli@1.2.0 gulp@3.9.1 @@ -37,9 +47,21 @@ jobs: bower install --force --allow-root - name: Build NPM package - run: npm run build-npm-pkg + run: | + npm run build-npm-pkg + ls -l - - name: Publish to NPM - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + # --- Upload to Google Cloud Storage --- + # - name: Setup Google Cloud SDK + # if: env.CLOUD_PROVIDER == 'gcp' + # uses: google-github-actions/setup-gcloud@v1 + # with: + # install_components: 'gsutil' + + # - name: Authenticate and Upload to Google Cloud Storage + # if: env.CLOUD_PROVIDER == 'gcp' + # run: | + # echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json + # gcloud auth activate-service-account --key-file=/tmp/service-account-key.json + # gsutil -m rsync -d -r content-editor gs://${{ secrets.GCP_BUCKET }}/content-editor-test/ + # rm -f /tmp/service-account-key.json \ No newline at end of file From 24da315879499cca1fc27cd7988f60a49d32eb10 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 05:19:48 +0530 Subject: [PATCH 07/22] Added build essentials --- .github/workflows/publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ffe8f76..ccc7915 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,6 +25,11 @@ jobs: node-version: '14' registry-url: 'https://registry.npmjs.org/' + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential libpng-dev + - name: Clone content plugins run: | git clone https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins -b release-5.2.0 From f5b472ad86776299c9af974e61bfbac55d2e9d2d Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 05:40:05 +0530 Subject: [PATCH 08/22] Updated the node vversion. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ccc7915..152f991 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '14' + node-version: '10.24.1' registry-url: 'https://registry.npmjs.org/' - name: Install system dependencies From 42cb64997f5efe1797f208aa2ae7a211c0770a2e Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 05:50:06 +0530 Subject: [PATCH 09/22] Updated the node version. --- .github/workflows/publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 152f991..ca8ec58 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,12 @@ on: branches: - '*' +env: + NODE_VERSION: 10.24.1 + version_number: ${{ github.ref_name }} + build_number: ${{ github.run_number }} + CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER || 'gcp' }} + jobs: publish: runs-on: ubuntu-latest @@ -22,7 +28,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '10.24.1' + node-version: ${{ env.NODE_VERSION }} registry-url: 'https://registry.npmjs.org/' - name: Install system dependencies From f4499a6eecba2331d499cb28f42ddc2e9aa391a3 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 05:54:38 +0530 Subject: [PATCH 10/22] u[dated the assetbrowser version. --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 7ec1333..698e596 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -231,7 +231,7 @@ gulp.task('build', ['minify', 'inject', 'replace', 'packageCorePlugins', 'zip']) var corePlugins = [ "org.ekstep.uploadcontent-1.5", - "org.ekstep.assetbrowser-1.4", + "org.ekstep.assetbrowser-1.3", "org.ekstep.uploadlargecontent-1.0", ] From 6cef1d7204dff54951382a81d87a0822b46b1229 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 06:00:56 +0530 Subject: [PATCH 11/22] u[dated the assetbrowser version. --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ca8ec58..19b3a18 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,8 +57,9 @@ jobs: bower cache clean --allow-root bower install --force --allow-root - - name: Build NPM package + - name: Build and package run: | + npm install gulp-gzip --save-dev npm run build-npm-pkg ls -l From e8370a744d7b134632f35e6c5e89cc4e9bb37f48 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 06:06:21 +0530 Subject: [PATCH 12/22] Update --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 19b3a18..d3b6551 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -62,6 +62,7 @@ jobs: npm install gulp-gzip --save-dev npm run build-npm-pkg ls -l + cat generic-editor # --- Upload to Google Cloud Storage --- # - name: Setup Google Cloud SDK From d0893f8b3c88bf82cc01cfee8aa1527aa85da4db Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 06:09:15 +0530 Subject: [PATCH 13/22] Update --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d3b6551..d4ee483 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -62,7 +62,8 @@ jobs: npm install gulp-gzip --save-dev npm run build-npm-pkg ls -l - cat generic-editor + cd generic-editor + ls -l # --- Upload to Google Cloud Storage --- # - name: Setup Google Cloud SDK From 99177a79044a5637fc3a0b6797bc83c97db01a66 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 06:11:49 +0530 Subject: [PATCH 14/22] Update --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d4ee483..feb2f52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -64,6 +64,7 @@ jobs: ls -l cd generic-editor ls -l + cat index.html # --- Upload to Google Cloud Storage --- # - name: Setup Google Cloud SDK From 381b1601bbb3cca75ffdf33106017ec89f1e571e Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 14:34:55 +0530 Subject: [PATCH 15/22] Updated the upload step --- .github/workflows/publish.yml | 47 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index feb2f52..469c321 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,9 @@ env: NODE_VERSION: 10.24.1 version_number: ${{ github.ref_name }} build_number: ${{ github.run_number }} - CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER || 'gcp' }} + CLOUD_PROVIDER: ${{ vars.CLOUD_PROVIDER }} + GCP_BUCKET: ${{ vars.GCP_BUCKET }} + AZURE_CONTAINER: ${{ vars.AZURE_CONTAINER }} jobs: publish: @@ -61,22 +63,31 @@ jobs: run: | npm install gulp-gzip --save-dev npm run build-npm-pkg - ls -l - cd generic-editor - ls -l - cat index.html - # --- Upload to Google Cloud Storage --- - # - name: Setup Google Cloud SDK - # if: env.CLOUD_PROVIDER == 'gcp' - # uses: google-github-actions/setup-gcloud@v1 - # with: - # install_components: 'gsutil' + - name: Setup Google Cloud SDK + if: env.CLOUD_PROVIDER == 'gcp' + uses: google-github-actions/setup-gcloud@v1 + with: + install_components: 'gsutil' - # - name: Authenticate and Upload to Google Cloud Storage - # if: env.CLOUD_PROVIDER == 'gcp' - # run: | - # echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json - # gcloud auth activate-service-account --key-file=/tmp/service-account-key.json - # gsutil -m rsync -d -r content-editor gs://${{ secrets.GCP_BUCKET }}/content-editor-test/ - # rm -f /tmp/service-account-key.json \ No newline at end of file + - name: Authenticate and Upload to Google Cloud Storage + if: env.CLOUD_PROVIDER == 'gcp' + run: | + echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json + gcloud auth activate-service-account --key-file=/tmp/service-account-key.json + gsutil -m cp -r generic-editor gs://${{ env.GCP_BUCKET }}/generic-editor-test/ + rm -f /tmp/service-account-key.json + + - name: Upload to Azure Blob Storage + if: env.CLOUD_PROVIDER == 'azure' + uses: azure/CLI@v1 + with: + azcliversion: latest + inlineScript: | + az storage blob upload-batch \ + --account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \ + --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \ + --destination "${{ vars.AZURE_CONTAINER }}/generic-editor-test" \ + --source content-editor \ + --overwrite \ + --content-cache-control "public, max-age=2592000" \ No newline at end of file From 40a25d645ec992b890848febf1252e69975329bf Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 14:49:24 +0530 Subject: [PATCH 16/22] Updated the upload step. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 469c321..dadbbbb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -88,6 +88,6 @@ jobs: --account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \ --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \ --destination "${{ vars.AZURE_CONTAINER }}/generic-editor-test" \ - --source content-editor \ + --source generic-editor \ --overwrite \ --content-cache-control "public, max-age=2592000" \ No newline at end of file From bc47b6e1072cd2d49eea9f14d83114fc1e5409d0 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 16:13:01 +0530 Subject: [PATCH 17/22] Update readme and the workflow file. --- .github/workflows/publish.yml | 28 +++++++++++---- README.md | 66 ++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dadbbbb..5ea9bd2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Publish Sunbird-generic-editor to blob on: push: - branches: + tags: - '*' env: @@ -40,7 +40,7 @@ jobs: - name: Clone content plugins run: | - git clone https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins -b release-5.2.0 + git clone https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins -b ${{ github.ref_name }} - name: Install global dependencies run: | @@ -75,7 +75,7 @@ jobs: run: | echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json gcloud auth activate-service-account --key-file=/tmp/service-account-key.json - gsutil -m cp -r generic-editor gs://${{ env.GCP_BUCKET }}/generic-editor-test/ + gsutil -m cp -r generic-editor gs://${{ env.GCP_BUCKET }}/generic-editor/ rm -f /tmp/service-account-key.json - name: Upload to Azure Blob Storage @@ -87,7 +87,23 @@ jobs: az storage blob upload-batch \ --account-name "${{ secrets.AZURE_STORAGE_ACCOUNT }}" \ --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \ - --destination "${{ vars.AZURE_CONTAINER }}/generic-editor-test" \ + --destination "${{ vars.AZURE_CONTAINER }}/generic-editor" \ --source generic-editor \ - --overwrite \ - --content-cache-control "public, max-age=2592000" \ No newline at end of file + --overwrite + +# Note: Publishing to AWS S3 is not tested. + + # - name: Configure AWS credentials + # if: env.CLOUD_PROVIDER == 'aws' + # uses: aws-actions/configure-aws-credentials@v4 + # with: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # aws-region: ${{ vars.AWS_REGION || 'us-east-1' }} + + # - name: Upload to Amazon S3 + # if: env.CLOUD_PROVIDER == 'aws' + # env: + # S3_BUCKET: ${{ vars.S3_BUCKET }} + # run: | + # aws s3 sync generic-editor s3://${{ env.S3_BUCKET }}/generic-editor/ \ No newline at end of file diff --git a/README.md b/README.md index 921c939..cdb722f 100644 --- a/README.md +++ b/README.md @@ -193,4 +193,68 @@ Make sure the following are set up **before** opening a pull request: Note: The secrets and variables should be set in Github UI (`settings/secrets and variables/actions`). -For any changes to the workflow, update the file `.github/workflows/build-test.yml` accordingly. \ No newline at end of file +For any changes to the workflow, update the file `.github/workflows/pull-request.yml` accordingly. + +# Build and Upload Content Editor Workflow + +**Workflow Name:** `Publish Sunbird-generic-editor to blob` + +This GitHub Actions workflow builds the Generic Editor and uploads the generated build artifacts to a cloud storage provider — **GCP**, **Azure**, or **AWS**. +It is triggered **whenever a new Git tag is pushed** to the repository. + +--- + +## Prerequisites + +Before triggering this workflow, ensure the following: + +- A valid Git tag is pushed to start the workflow. +- The pushed tag **must also exist** in the [`sunbird-content-plugins`](https://github.com/project-sunbird/sunbird-content-plugins) repository. +- Required **GitHub Actions Variables** and **Secrets** are configured based on the selected cloud provider. + +You can set **Variables and Secrets** in GitHub under: +`Settings → Secrets and Variables → Actions` + +--- + +## Cloud Provider Configuration + +The workflow uses the `CLOUD_PROVIDER` variable to determine where to upload the build artifacts. Based on the provider selected, configure the following: + +### GCP (Google Cloud Platform) + +**Repository Variable:** +- `CLOUD_PROVIDER` = `gcp` +- `GCP_BUCKET` — Name of the GCP bucket to upload to. + +**Repository Secret:** +- `GCP_SERVICE_ACCOUNT_KEY` — Base64-encoded GCP service account key. + +--- + +### Azure + +**Repository Variable:** +- `CLOUD_PROVIDER` = `azure` +- `AZURE_CONTAINER` — Name of the Azure Blob Storage container. + +**Repository Secrets:** +- `AZURE_STORAGE_ACCOUNT` — Azure Storage account name. +- `AZURE_STORAGE_KEY` — Azure Storage account key. + +--- + +### AWS (Amazon Web Services) + +> **Note:** AWS upload is defined in the workflow but marked as **not tested**. + +**Repository Variable:** +- `CLOUD_PROVIDER` = `aws` +- `S3_BUCKET` — Name of the AWS S3 bucket. +- `AWS_REGION` — AWS region where the bucket is located. + +**Repository Secrets:** +- `AWS_ACCESS_KEY_ID` — AWS access key ID. +- `AWS_SECRET_ACCESS_KEY` — AWS secret access key. + +--- \ No newline at end of file From 5f56c579af6a5e796db44d097ce05e3336a0b085 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 16:17:30 +0530 Subject: [PATCH 18/22] Updated Readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdb722f..a43eb29 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ Note: The secrets and variables should be set in Github UI (`settings/secrets an For any changes to the workflow, update the file `.github/workflows/pull-request.yml` accordingly. -# Build and Upload Content Editor Workflow +# Build and Upload Generic Editor Workflow **Workflow Name:** `Publish Sunbird-generic-editor to blob` From c07d1fa50e36820b5d3dfd384d28739f33f17e32 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Tue, 22 Jul 2025 16:33:38 +0530 Subject: [PATCH 19/22] Updated cpy cmd. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5ea9bd2..ca4c35c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -75,7 +75,7 @@ jobs: run: | echo "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}" | base64 -d > /tmp/service-account-key.json gcloud auth activate-service-account --key-file=/tmp/service-account-key.json - gsutil -m cp -r generic-editor gs://${{ env.GCP_BUCKET }}/generic-editor/ + gsutil -m cp -r generic-editor/* gs://${{ env.GCP_BUCKET }}/generic-editor/ rm -f /tmp/service-account-key.json - name: Upload to Azure Blob Storage From f1142d89db28766ff96f446319ffcde1ce2b72e2 Mon Sep 17 00:00:00 2001 From: vinodbhorge Date: Wed, 23 Jul 2025 17:38:19 +0530 Subject: [PATCH 20/22] Reverted asstetbrowser version --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 698e596..7ec1333 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -231,7 +231,7 @@ gulp.task('build', ['minify', 'inject', 'replace', 'packageCorePlugins', 'zip']) var corePlugins = [ "org.ekstep.uploadcontent-1.5", - "org.ekstep.assetbrowser-1.3", + "org.ekstep.assetbrowser-1.4", "org.ekstep.uploadlargecontent-1.0", ] From 6fbcf5cb60e032b9e92f76fb046d030f45461b73 Mon Sep 17 00:00:00 2001 From: yashash <126703764+yashashkumar@users.noreply.github.com> Date: Thu, 31 Jul 2025 18:46:31 +0530 Subject: [PATCH 21/22] Update pull-request.yml --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9ce5311..ac21f0e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -31,7 +31,7 @@ jobs: - name: Clone plugins (from fork) run: | - git clone --branch ${{ env.CONTENT_PLUGIN_VERSION }} https://github.com/vinodbhorge/sunbird-content-plugins.git plugins + git clone --branch ${{ env.CONTENT_PLUGIN_VERSION }} https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins - name: Install dependencies run: | @@ -98,4 +98,4 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} - name: Run Lint - run: npm run lint \ No newline at end of file + run: npm run lint From 4478c6e66d5dc39701564c3e7aa5ecfcdc9f567b Mon Sep 17 00:00:00 2001 From: yashash <126703764+yashashkumar@users.noreply.github.com> Date: Fri, 26 Sep 2025 17:15:29 +0530 Subject: [PATCH 22/22] Update plugin repository URL in publish workflow --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ca4c35c..95662cd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,7 +40,7 @@ jobs: - name: Clone content plugins run: | - git clone https://github.com/Sunbird-Knowlg/sunbird-content-plugins.git plugins -b ${{ github.ref_name }} + git clone https://github.com/sanketika-labs/sunbird-content-plugins.git plugins -b ${{ github.ref_name }} - name: Install global dependencies run: | @@ -106,4 +106,4 @@ jobs: # env: # S3_BUCKET: ${{ vars.S3_BUCKET }} # run: | - # aws s3 sync generic-editor s3://${{ env.S3_BUCKET }}/generic-editor/ \ No newline at end of file + # aws s3 sync generic-editor s3://${{ env.S3_BUCKET }}/generic-editor/